Bug #23008 Bug Fixed

Exception when overwriting file upload

Version: 3.5.3 Reporter: James Catt

This is an archived bug report. If you are experiencing a similar issue, upgrade to the latest release and if that does not solve the problem, submit a new bug report

When trying to overwrite a file upload, I’m getting the following exception:

Exception Caught

Cannot copy non-existent path: /srv/sites/donrivervalleypark.ca/img/map/_thumbs/map-drvp-layer-trails_1.svg

ee/EllisLab/ExpressionEngine/Library/Filesystem/Filesystem.php:243

Stack Trace: hide details

#0 ee/EllisLab/ExpressionEngine/Service/File/Upload.php(455): EllisLab\ExpressionEngine\Library\Filesystem\Filesystem->copy('/srv/sites/donr...', '/srv/sites/donr...')
#1 ee/EllisLab/ExpressionEngine/Controller/Files/Files.php(257): EllisLab\ExpressionEngine\Service\File\Upload->resolveNameConflict('6117')
#2 [internal function]: EllisLab\ExpressionEngine\Controller\Files\Files->finishUpload('6117')
#3 ee/EllisLab/ExpressionEngine/Core/Core.php(189): call_user_func_array(Array, Array)
#4 ee/EllisLab/ExpressionEngine/Core/Core.php(94): EllisLab\ExpressionEngine\Core\Core->runController(Array)
#5 ee/EllisLab/ExpressionEngine/Boot/boot.php(151): EllisLab\ExpressionEngine\Core\Core->run(Object(EllisLab\ExpressionEngine\Core\Request))
#6 sites/evergreen.ca/www/expr_admin.php(143): require_once('e...')
#6 sites/evergreen.ca/www/expr_admin.php(143): require_once('e...')

I can confirm that the the _thumbs folder exists and that the file it references does not exist (but there are other thumbnails in the folder and it is writeable).

When I go back to the file manager after this exception, it lists a file called map-drvp-layer-trails_1.svg but has an error flag on it saying that the file can’t be found.

For reference, I was trying to upload a file named map-drvp-layer-trails.svg and selected the option to overwrite a previous copy. It sounds like it was still trying to rename the file though?

  • --- a/system/ee/EllisLab/ExpressionEngine/Service/File/Upload.php
    +++ b/system/ee/EllisLab/ExpressionEngine/Service/File/Upload.php
    @@ -452,7 +452,11 @@ public function resolveNameConflict($file_id)
         }
     
         ee('Filesystem')->copy($file->getAbsolutePath(), $original->getAbsolutePath());
    -    ee('Filesystem')->copy($file->getAbsoluteThumbnailPath(), $original->getAbsoluteThumbnailPath());
    +
    +    if (file_exists($file->getAbsoluteThumbnailPath()))
    +    {
    +     ee('Filesystem')->copy($file->getAbsoluteThumbnailPath(), $original->getAbsoluteThumbnailPath());
    +    }
     
         foreach ($file->UploadDestination->FileDimensions as $fd)
         {
.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases