Upgrading to 5.46 Deleted Routes and Redirects and Broke All Images

I upgraded from 5.44 to 5.46 and everything has broken. Ghost deleted my Routes and Redirects configurations and broke the path for most uploaded images. I thought fixing the Routes and Redirects might correct the image issue, but it did not.

Ghost is running behind Cloudflare, which I read that some caching settings might cause an issue. I’m not sure if that’s the case or which settings I need to adjust. I also read that an issue might arise if the config file doesn’t have https:// in the URL. I confirmed that my site is configured with https://.

Edit: The only images affected are the self-hosted ones. Unsplash linked images are fine. The core Ghost platform images are fine. The logos and post images I’ve uploaded are broken.

Edit 2: It seems like all images were in the /instance/versions/5.44.0/content/images folder and not the base /instance/content/images folder. The upgrade to 5.46 didn’t move the images to the /instance/versions/5.46.0/content/images. I’m currently manually copying the content into that folder and the images are being restored. Is there a reason images are uploading to into the version folder structure which will change every time the site is updated?

It sounds like an upgrade didn’t successfully conclude. All your files should be in the content/ folder, not the versions/content/ folder. A symbolic link is created to the latest version of Ghost.

I host behind Cloudflare, and this doesn’t affect updates via SSH. How are you performing the updates, and how are you copying files?

Your folder structure should look similar to this. I assume “instance” is equivalent to “ghost” below.

536152 -rw-rw-r--  1 user user 26698502 Apr 13 14:32 backup-from-v5.41.0-on-2023-04-13-14-32-00.zip
521106 -rw-rw-r--  1 user user 26698632 Apr 24 17:37 backup-from-v5.43.0-on-2023-04-24-17-36-31.zip
520891 -rw-rw-r--  1 user user 26698599 Apr 27 14:05 backup-from-v5.44.0-on-2023-04-27-14-05-09.zip
525013 -rw-rw-r--  1 user user      880 Apr 27 14:07 config.production.json
778033 drwxrwxr-x 11 ghost  ghost  4096 Oct 23  2022 content/
520909 lrwxrwxrwx  1 user user       41 Apr 27 14:07 current -> /var/www/ghost/versions/5.45.1/
546696 -rw-rw-r--  1 user user      201 Apr 27 14:07 .ghost-cli
766903 drwxrwxr-x  4 user user     4096 Apr 27 14:07 versions/

You may want to run ghost doctor when you’re done.

The instance directory replaces the ghost directory on my instal for some reason. It’s a shared-hosting server with Opalstack. I did run ghost doctor and it reported an error, that my user folder isn’t accessible by all users, which I attribute to the shared hosting. My permissions appear to match the folder permissions you posted above. The only difference I notice is that content and versions are rwxrwxr-x not drwxrwxr-x, for whatever the d represents.

The “d” means it is a directory, and that’s what content and versions should be. This suggests something is seriously broken with your installation.

Is current a symbolic link, i.e., preceded with an “l”? If so, what does it point to?

Make sure your config.production.json is properly configured - paths.contentPath should point to a non-versioned folder (e.g. /path/to/ghost/content opposed to /path/to/ghost/versions/current/content)

This is what appears in the config file for paths.

It is a symbolic link.

Can you try changing it to an absolute path?

Can you give me an example?

Typically, the base directory for Ghost is /var/www/ghost. Yours appears to be /home/<redacted>/apps/ghost_app/instance.

Therefore, the absolute path would be /home/<redacted>/apps/ghost_app/instance/content/.

When changing to the absolute path, Ghost won’t boot. The errors read that the content path doesn’t exist.

Can you make sure the path exists? I think you mentioned that you copied the content from versions/a to versions/b - now you’ll want to move it to content (make sure the path you move it to aligns with what you put in the config)

Right. The content path in the config is "paths": { "contentPath": "content/" }, which should point to /home/<user>/apps/ghost_app/instance/content/ since the config file is in /home/<user>/apps/ghost_app/instance/. When I changed it to read the full directory address, Ghost wouldn’t boot.

I manually moved the images, routes, and redirects files into their appropriate places from the /instance/versions/5.44.0/content/ directory. However, I know Ghost is still reading the information from the /instance/versions/5.44.0/content/ directory because I deleted the routes file from there and my routing rules broke when I rebooted Ghost despite them being in the appropriate /instance/content/settings/ directory.

I just updated to 5.46.1 and it again is only pulling from the versions director, not the content directory. Any idea how I can fix this so I don’t have to manually add files with every update?