Cms: Moving assets causes entries to lose those assets

Created on 7 Jan 2021  Â·  5Comments  Â·  Source: statamic/cms

Bug Description

When moving an asset in the asset manager, entries that had that asset selected lose a reference to it.

How to Reproduce

  1. Create an entry with an asset field
  2. Add an asset to that field
  3. Move the asset to a folder

Environment

Statamic version: 3.0.37

PHP version: 8.0

Install method (choose one):

  • Starter kit
assets ux

Most helpful comment

I know that we are in feature request territory here, but couldn't adding an asset to an entry update the asset's meta .yaml file to add that association? This association could be deleted if the asset is removed from the entry or if the entry is deleted.

That way it could at least show a warning, like "This asset is linked to these entries: [...] if you move/delete it will result in broken links" rather than a general warning that appears everywhere and provides no useful info.

All 5 comments

That's how basically every CMS asset manager works – it's a huge endeavor to come up with a solution to scan all of the data in the entire site to update references whenever a file name is changed. I think this is more a feature request than a bug – what do you think @jasonvarga?

That's how basically every CMS asset manager works

That's a wrong statement, I know for a fact this works in CraftCMS as an example, but I do know this is easier to solve in a database driven environment, as they use IDs to reference assets, the path is stored in the db next to the id.

Also, for clients this very much feels like a bug, they move an asset and all their pages break.

We have the scary warning when you try to rename an asset, but not when you move it. I wrongly assumed it was on both actions.

We can easily add that warning, at least.

image
image

I know that we are in feature request territory here, but couldn't adding an asset to an entry update the asset's meta .yaml file to add that association? This association could be deleted if the asset is removed from the entry or if the entry is deleted.

That way it could at least show a warning, like "This asset is linked to these entries: [...] if you move/delete it will result in broken links" rather than a general warning that appears everywhere and provides no useful info.

@jasonvarga Yes. Please add this warning for every way things can break (move, rename, something else?).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andrewying picture andrewying  Â·  4Comments

jelleroorda picture jelleroorda  Â·  3Comments

robdekort picture robdekort  Â·  3Comments

jimblue picture jimblue  Â·  3Comments

skoontastic picture skoontastic  Â·  4Comments