When replacing asset keep same url

Is your feature request related to a problem? Please describe.
When uploading assets and using them in rich text fields, which we are doing quite a bit, when replacing the assets in media we expected the url to remain the same so that all the links would point to the new asset. Unfortunately the url changes every time we use “replace asset”, making the user have to know where that asset is being linked to and manually go and update them. We also may use these urls outside of the CMS which would cause more headache.

Describe the solution you’d like
The ability to keep the original url of the asset when it’s replaced.

Describe alternatives you’ve considered
We have to manually update urls and it gets hard to remember where everything is used to update.

Sorry but our CDN has to be considered immutable: you cannot change the content of an existing URL afterwards. This allows us to be extremely fast and forever cacheable.

So what are we supposed to do when someone adds an asset to a markdown or html block and they update that asset in the CMS backend? It won’t update automatically and there is no indicator that the file url needs to be updated in different places.

@flipxfx I think the best way to deal with this is to use a modular content with an asset so that you can avoid having lost links inside.

If you really cannot avoid the markdown the only idea I have is that you set up some webhook and you take care yourself to update the URLs of the images whenever you change the assets :frowning:

Yes our users link to documents and like to put pictures mid-content for blogs etc. It would be awkward to have to use modular content just to put links to things. :thinking:

We found it sort of misleading since you can choose images to place in HTML/Markdown blocks via the media explorer. If there’s no good way to fix this I would at least warn the user that the asset they pick will not be updated if it’s updated via media.

If there’s no way for this to work correctly with the current CDN what would a webhook like this look like? Or is there some way to have urls in-front the CDN that don’t change or a way to invalidate?

Makes sense what you are saying.

We are going to try something out to see if that is not too heavy on our DB, not sure when, but we are going to try something out.

@matjack1 Was there any progress on this feature examination? We just discovered this same issue rolling out a DatoCMS driven blog to non-technical end-users. Their perfectly acceptable expectation is that an incorrect image can be replaced using the “replace” function. We also have some rarely changing assets such as PDF privacy policies linked in the footer that now require developer intervention to update.

While I understand the CDN argument that @stefano.verna makes at the top of this thread, it’s not really acceptable by 2020+ expectations. Most (all?) CDNs allow asset invalidation for this very reason.

@troy.forster your argument makes sense for sure. We’ll try having a look as we’ll probably work on something related.

2 Likes

Hey @mat_jack1 – just wanted to follow up here and say that we also found ourselves needing a feature that would allow us to replace files/media while keeping the same URL. Was there any progress this year? Thanks

Hey @kenny this problem persists as it’s a base behaviour of our image management right now. We have improved in deleting unused assets, but we don’t have yet a way to implement redirects sorry. We know it’s useful but it’s a problem that we should address on a very low level that at the moment is still quite complex, sorry :frowning:

1 Like

Same problem here. Couldn’t the solution be a manual or automatic redirect as requested here?

Hi @mat_jack1

This problem has come up for us a few times too, where we need to replace an asset with a new version and users had saved the link to the previous URL.

A manual or automatic redirect as the previous post linked to would be great. But another option is what if assets could be assigned a slug/path alias that always persists? Basically like a permanent redirect?

Hi everyone,

I am running into the same issue as described in this thread - replaced a pdf with a minor change, and now the url to the previous pdf doesnt work and we cannot redirected it. Is there any work going on to improve this @datocms? thx.

1 Like

Sorry Dato, I will push this one up a bit, if we can see this feature happening anytime soon. Would save us a lot of rebuilds.

Our use case is like this:

  1. We are serving PDF manuals from the assets.
  2. Manuals get frequently updated and we have quite few of them
  3. When I replace manual PDF, the asset link get’s changed and I have to rebuild and redeploy the page and search index because of the new asset URL
  4. Have several manual changes in a week trough-out our product line.

Thanks,
Primoz

2 Likes

For another way in which this kind of capability is needed, see this forum discussion: How to change save as asset name? - #9 by donnie.hale

I see that the issue I’m having has been raised before, and even that I’ve commented on this before.

So let me reiterate that it’s extremely poor form to not allow updating an asset “in place.” This behavior means that content items that reference the URL (as opposed to the media asset itself) are now broken. In some cases (my current one), it’s more convenient / better to reference the URL because I just want one media asset that all of the project’s environments reference. There’s no need to have identical images in every environment, each with a different URL.

I understand the desire for a high performance CDN. But every CDN has means to refresh an item - it’s an extraordinarily common use case.

Given that this is the intended behavior (bad as it is), there should be a warning that it will result in a new URL (and possibly a different label than “Replace asset”). But a “Preserve URL” option would be better, even if that means informing the user that the new asset won’t be visible for a certain period.

Thanks.

1 Like