Cms: Updating asset index not working when there's only one file in asset volume

Created on 18 Aug 2020  路  3Comments  路  Source: craftcms/cms

Description

When there's only one file in an asset volume and the asset index of that volume is updated via Utilities>Asset Indexes, the assets index of that volume is not rebuilt correctly. For example, if that lone file is manually deleted (outside of the CP) and the asset index is updated, Craft doesn't detect the file is removed.

Normally, Craft would alert a missing file couldn't be found and asks if it should be deleted from the index. However, this prompt doesn't appear. In fact, an alert about .DS_Store not being able to be indexed appears (which would also be nice to get rid of).

If there's more than one file in the asset volume, reindexing works properly.

Steps to reproduce

  1. Upload one asset to an assets volume by CP
  2. Remove uploaded asset outside of CP
  3. Reindex the asset volume of where asset was uploaded via Utilities>Asset Indexes
  4. Go to Assets in CP, click on the asset volume. The removed asset still appears.

Additional info

  • Craft version: 3.5.5
  • PHP version: 7.4.5
  • Database driver & version: MySQL 5.7.29
  • Plugins & versions:
    "aelvan/imager": "v2.4.0",
    "anubarak/craft-relabel": "2.0.2",
    "barrelstrength/sprout-encode-email": "^2.0.7",
    "born05/craft-assetusage": "2.1.0",
    "craftcms/aws-s3": "1.2.9",
    "craftcms/cms": "3.5.5",
    "craftcms/mailgun": "^1.4.2",
    "craftcms/redactor": "2.7.1",
    "doublesecretagency/craft-inventory": "2.1.0",
    "experience/overflow": "2.0.0",
    "mmikkel/retcon": "2.2.1",
    "nystudio107/craft-cookies": "^1.1.12",
    "nystudio107/craft-minify": "1.2.10",
    "nystudio107/craft-seomatic": "3.3.16",
    "nystudio107/craft-twigpack": "1.2.5",
    "nystudio107/craft-twigprofiler": "^1.0.1",
    "nystudio107/craft-typogrify": "^1.1.18",
    "nystudio107/dotenvy": "^1.0",
    "ostark/craft-plugin-commands": "^1.1",
    "pennebaker/craft-architect": "2.3.3",
    "putyourlightson/craft-blitz-recommendations": "^1.1.0",
    "putyourlightson/craft-elements-panel": "^1.1.0",
    "putyourlightson/craft-sprig": "1.0.0-beta.10",
    "sebastianlenz/linkfield": "1.0.23",
    "solspace/craft-express-forms": "1.0.6",
    "studioespresso/craft-dumper": "2.0.0",
    "studioespresso/craft-seeder": "3.2.0",
    "vaersaagod/seomate": "^1.1.4",
    "verbb/cp-nav": "3.0.13.1",
    "verbb/expanded-singles": "1.1.3",
    "verbb/image-resizer": "2.0.10",
    "vlucas/phpdotenv": "^3.4.0",
    "yiisoft/yii2-redis": "^2.0"
bug

All 3 comments

Thanks for reporting that. Able to reproduce and we鈥檒l get it fixed. In the meantime you can run the following command:

php craft index-assets/one <yourVolumeHandle> --delete-missing-assets

Thanks for reporting! Just fixed it for the next release!

Craft 3.5.6 is out now with that fix.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

brandonkelly picture brandonkelly  路  3Comments

darylknight picture darylknight  路  3Comments

leigeber picture leigeber  路  3Comments

timkelty picture timkelty  路  3Comments

michel-o picture michel-o  路  3Comments