craftcms / cms

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

[4.x]: Error after Update Asset Indexes #10905

Closed mark-reactor15 closed 2 years ago

mark-reactor15 commented 2 years ago

What happened?

Description

After running "Update Asset Indexes" in Utilities, the modal appears with files and folders that no longer exist, clicking the button to delete them results in a "null" javascript alert, and the files/folders aren't removed from the asset index.

Expected behavior

Asset Indexes properly refreshed and updated.

Actual behavior

Error returned from /index.php?p=admin%2Factions%2Fasset-indexes%2Ffinish-indexing-session&v=1649772128699

{"error":"craft\\services\\Assets::getFolderById(): Argument #1 ($folderId) must be of type int, string given, called in /home/storm/sites/site/vendor/craftcms/cms/src/services/Assets.php on line 293","exception":"TypeError","file":"/home/storm/sites/site/vendor/craftcms/cms/src/services/Assets.php","line":388,"trace":[{"file":"/home/storm/sites/site/vendor/craftcms/cms/src/services/Assets.php","line":293,"function":"getFolderById","class":"craft\\services\\Assets","type":"->"},{"file":"/home/storm/sites/site/vendor/craftcms/cms/src/controllers/AssetIndexesController.php","line":203,"function":"deleteFoldersByIds","class":"craft\\services\\Assets","type":"->"},{"function":"actionFinishIndexingSession","class":"craft\\controllers\\AssetIndexesController","type":"->"},{"file":"/home/storm/sites/site/vendor/yiisoft/yii2/base/InlineAction.php","line":57,"function":"call_user_func_array"},{"file":"/home/storm/sites/site/vendor/yiisoft/yii2/base/Controller.php","line":178,"function":"runWithParams","class":"yii\\base\\InlineAction","type":"->"},{"file":"/home/storm/sites/site/vendor/yiisoft/yii2/base/Module.php","line":552,"function":"runAction","class":"yii\\base\\Controller","type":"->"},{"file":"/home/storm/sites/site/vendor/craftcms/cms/src/web/Application.php","line":301,"function":"runAction","class":"yii\\base\\Module","type":"->"},{"file":"/home/storm/sites/site/vendor/craftcms/cms/src/web/Application.php","line":625,"function":"runAction","class":"craft\\web\\Application","type":"->"},{"file":"/home/storm/sites/site/vendor/craftcms/cms/src/web/Application.php","line":280,"function":"_processActionRequest","class":"craft\\web\\Application","type":"->"},{"file":"/home/storm/sites/site/vendor/yiisoft/yii2/base/Application.php","line":384,"function":"handleRequest","class":"craft\\web\\Application","type":"->"},{"file":"/home/storm/sites/site/web/index.php","line":12,"function":"run","class":"yii\\base\\Application","type":"->"}]}

Craft CMS version

4.0.0-beta.4

PHP version

8.0.17

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

-

andris-sevcenko commented 2 years ago

Thanks for reporting - just fixed for the next beta release!

brandonkelly commented 2 years ago

Craft 4.0.0-RC1 is out now with this fix.