The URLs of the uploads are “optimized” (i.e. made absolute and use CDN when enabled) when cooking a post for performance reasons. The solution to your problem is indeed a remap. More can be found here
I’m having a similar problem with posted images on the forum I’m working on, I also have a support thread about it.
The background is a little different: I haven’t renamed the forum, but I did migrate it to docker and set up HTTPS. We use AWS and the S3 bucket’s name had forbidden characters so we renamed the bucket, but all images are still pointing to the old bucket name which doesn’t work.
Is it possible to use remap to point these images to the new bucket name? Also, are you running remap from the same place as you run rake commands?
Yes. If the old bucket name is unique enough, you can just remap on that, otherwise you’ll want to expand out the string (to include, say, the full domain) to avoid false matches. The remap process is a very blunt instrument, it just does straight-up text search-and-replace.
Yes, the full command is ./script/discourse remap <oldstring> <newstring>.
Okay, so I ran that command, but I got this error:
/usr/local/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- thor (LoadError)
from /usr/local/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from ./script/discourse:3:in `<main>'
I’ll admit I’m not really great with ruby, not sure what is happening here. Any clues?
URGENT: FATAL: Peer authentication failed for user "discourse"
Failed to initialize site default
Rewriting all occurences of mybucket
THIS TASK WILL REWRITE DATA, ARE YOU SURE (type YES)
bundler: failed to load command: ./script/discourse (./script/discourse)
PG::ConnectionBad: FATAL: Peer authentication failed for user "discourse"