Broken image links to old S3 bucket


(Doron) #1

To make a long story short, a forum was started with images being uploaded to one S3 bucket. There was a problem and that bucket no longer exists. All image links are now broken.I’ve setup a new bucket and I’m trying to upload the images again.

Unfortunately, when trying to upload the same images again, it “recognizes” them and instead of uploading them again to the new bucket and giving them a new link, it uses the old link it has cached somewhere. I tried all possible settigns, including disabling upload to S3, asking it to fetch remote images, cleanup and rebuild of the instance, renaming the files. Nothing helped. The cached links persist and prevent me from uploading the same images again.

Any idea?

Thanks


(Régis Hanol) #2

You will have to destroy the Upload records for all your broken images via the rails console.


(Doron) #3

Can someone point out how exactly to do that step by step?
I’m ok with destroing ALL upload records.
Thanks


(Régis Hanol) #4

In that case, ssh into your server where Discourse is installed

cd /var/discourse
./launcher enter app
rails c
Upload.destroy_all # ⚠️ will destroy all your upload records