craftcms / cms

Build bespoke content experiences with Craft.
https://craftcms.com
Other
3.28k stars 635 forks source link

Internal Server Error after removing the uploaded file #5740

Closed ljfreelancer88 closed 4 years ago

ljfreelancer88 commented 4 years ago

Description

I got 500(Internal Server Error) in the console log after removing the uploaded file from disk.

Steps to reproduce

  1. Click the "Add an asset" to open the window/modal for uploading files.
  2. Click the "Upload files" to select file to upload. Select single file, then upload.
  3. Delete the uploaded file from disk
  4. Refresh the page
  5. Open console log
  6. Repeat step 0 *These steps was done in Entries(Single Section)

Additional info

brandonkelly commented 4 years ago

Clear out your storage/logs/ directory, then reproduce the error, then open storage/logs/web.log and search for [error]. Please post the error here, as well as the following stack trace.

ljfreelancer88 commented 4 years ago
[error]
[craft\errors\VolumeObjectNotFoundException] craft\errors\VolumeObjectNotFoundException: The file "about_img_1_200229_003348.jpg" does not exist. in C:\laragon\www\coolapp.com\vendor\craftcms\cms\src\services\AssetTransforms.php:966

Stack trace:
#0 C:\laragon\www\coolapp.com\vendor\craftcms\cms\src\services\Assets.php(720): craft\services\AssetTransforms->getLocalImageSource(Object(craft\elements\Asset))
#1 C:\laragon\www\coolapp.com\vendor\craftcms\cms\src\controllers\AssetsController.php(1091): craft\services\Assets->getThumbPath(Object(craft\elements\Asset), 32, 32, true)
#2 [internal function]: craft\controllers\AssetsController->actionThumb('912efe8a-359a-4...', 32, 32)
#3 C:\laragon\www\coolapp.com\vendor\yiisoft\yii2\base\InlineAction.php(57): call_user_func_array(Array, Array)
#4 C:\laragon\www\coolapp.com\vendor\yiisoft\yii2\base\Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#5 C:\laragon\www\coolapp.com\vendor\craftcms\cms\src\web\Controller.php(178): yii\base\Controller->runAction('thumb', Array)
#6 C:\laragon\www\coolapp.com\vendor\yiisoft\yii2\base\Module.php(528): craft\web\Controller->runAction('thumb', Array)
#7 C:\laragon\www\coolapp.com\vendor\craftcms\cms\src\web\Application.php(290): yii\base\Module->runAction('assets/thumb', Array)
#8 C:\laragon\www\coolapp.com\vendor\craftcms\cms\src\web\Application.php(558): craft\web\Application->runAction('assets/thumb', Array)
#9 C:\laragon\www\coolapp.com\vendor\craftcms\cms\src\web\Application.php(269): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#10 C:\laragon\www\coolapp.com\vendor\yiisoft\yii2\base\Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#11 C:\laragon\www\coolapp.com\web\index.php(21): yii\base\Application->run()
#12 {main}
2020-03-03 11:57:13 [-][1][-][info][application] $_GET = [
    'p' => 'admin/actions/assets/thumb'
    'uid' => '912efe8a-359a-492d-ab1b-7686f5570311'
    'width' => '32'
    'height' => '32'
    'v' => '1582936429'
]
andris-sevcenko commented 4 years ago

If you modify files outside of Craft in a folder that is tracked by Assets you should run the Asset Indexing utility, so that Craft is aware of what's going on (https://docs.craftcms.com/v3/assets.html#updating-asset-indexes)