We had a server crash and had to create a new server and restore from a backup. It was a harrowing process, details for what happened and how we restored it here.
Now after restoring (the key was to disable S3 uploads), all the links to attachments in posts are broken (404 error). I’ve searched the forum and can’t find a solution and hoping someone can point me in the right direction.
I have two options
- Can I fix these broken
short-urllinks which link to attachments embedded in posts (all the broken links are for attachments in posts; embedded images render fine, other internal link work fine)?
For example, the URL to the attachment on a post on the forum shows as
https://XYZ.com/uploads/short-url/phu1HOLvkE8LWpkKYfnMPSWsvHh.zip This is what I’m seeing in the logs when I click on an attachment link in a post (which leads to a 404).
Message (5 copies reported)
Failed to process hijacked response correctly : Errno::ENOENT : No such file or directory @ rb_sysopen - /XXXXX.s3.dualstack.us-east-1.amazonaws.com/optimized/1X/46728e07f9819907d1b18387bf02ea7fc25c7981_2_32x32.ico
read' /var/www/discourse/app/controllers/static_controller.rb:160:inblock (2 levels) in favicon’
block in memoize' /var/www/discourse/lib/distributed_mutex.rb:33:inblock in synchronize’
block in favicon' /var/www/discourse/lib/hijack.rb:56:ininstance_eval’
I’m really hoping there’s a way to fix these
short-url links after disabling the S3 upload option while restoring the server from a backup. A post re-bake did not fix it.
- If for someone reason this is a dead-end and cannot be fixed en mass, now I’ve had thousands of orphaned attachments on the S3 cloud, is there a way to clean them up and free up the space? Is there a way Discourse can go through it’s S3 upload bucket and clear out all orphaned assets?