Media file replacement changing the URL and breaking hardcoded links
In umbraco 11 - when you replace a media file, it will change the URL to the new media file name and therefore break any hardcoded links to the original file.
expected:
User wants to update a media file
user opens media file in the media library - example: ' Error Test Image' in the testing folder' in with media library. https://cms.scouts.org.uk/media/q5jlmmou/error-test-image.jpg
user 'removes file'
user replaces image with another image
user clicks save
url for the image remains the same as before, but with the new image displaying
All uses of the image (and the URL) remain
actual:
User wants to update a media file
user opens media file in the media library - example: ' Error Test Image' in the testing folder' in with media library. https://cms.scouts.org.uk/media/q5jlmmou/error-test-image.jpg
user 'removes file'
user replaces image with another image
user clicks save
URL for the image URL changes to the new image URL
All uses of the image (and the URL) are broken for hardcoded links
We don't encourage it. Obviously we would prefer content producers to use the picker, but we do know that this doesn't always happen and some producers will use a link to the image instead.
Apologies for bumping this thread, but I just wanted to point out that this is possible, but you need to ensure that the filename is identical to the old filename.
E.g. here's a GIF of me replacing a PDF with a PDF of the same name, but with different content, on Umbraco 12.3:
As you can see, the URL is retained as the filename is the same.
I have clients who regularly replace files in this manner, as they link files on external sites and don't/can't update those external URLs...
But if a URL does change, then you can use something like the Skybrud Redirects package to easily create a re-direct.
And yea, as Huw said, automating this would require a substantial amount of custom code 😬 (not worth it in my opinion, better to just make your content editors aware that they need to keep the filename the same)
Media file replacement changing the URL and breaking hardcoded links
In umbraco 11 - when you replace a media file, it will change the URL to the new media file name and therefore break any hardcoded links to the original file.
expected: User wants to update a media file user opens media file in the media library - example: ' Error Test Image' in the testing folder' in with media library. https://cms.scouts.org.uk/media/q5jlmmou/error-test-image.jpg user 'removes file' user replaces image with another image user clicks save url for the image remains the same as before, but with the new image displaying All uses of the image (and the URL) remain
actual: User wants to update a media file user opens media file in the media library - example: ' Error Test Image' in the testing folder' in with media library. https://cms.scouts.org.uk/media/q5jlmmou/error-test-image.jpg user 'removes file' user replaces image with another image user clicks save URL for the image URL changes to the new image URL All uses of the image (and the URL) are broken for hardcoded links
Is it possible to have the URL remain the same?
Why are you using hardcoded image urls?
We don't encourage it. Obviously we would prefer content producers to use the picker, but we do know that this doesn't always happen and some producers will use a link to the image instead.
If they used the picker then this problem would not occur.
It would require quite a bit of custom code to change the way the media items are saved, even if it were possible.
Thanks so much for clarifying.
Apologies for bumping this thread, but I just wanted to point out that this is possible, but you need to ensure that the filename is identical to the old filename.
E.g. here's a GIF of me replacing a PDF with a PDF of the same name, but with different content, on Umbraco 12.3: As you can see, the URL is retained as the filename is the same.
I have clients who regularly replace files in this manner, as they link files on external sites and don't/can't update those external URLs...
But if a URL does change, then you can use something like the Skybrud Redirects package to easily create a re-direct.
And yea, as Huw said, automating this would require a substantial amount of custom code 😬 (not worth it in my opinion, better to just make your content editors aware that they need to keep the filename the same)
is working on a reply...