Logo upload is not working after restore from backup

Scratch that, I’ve hit the issue again… So, the logo images worked fine until I cleared my browser cache.

Solution

The root cause was that most of the images were not correctly restored from the backup during the restore operation. I was able to solve the issue by manually extracting the tarball and copying over the missing images into the Discourse uploads directory.

Analysis

When I try to upload a new logo, I see the following:

  1. Image upload seems to work fine:

  1. But then the subsequent GET to display the uploaded image hits a 404:

  1. The image is not present in the uploads directory:
/var/discourse# tree shared/standalone/uploads/default/original/
shared/standalone/uploads/default/original/
`-- 1X
    |-- 52b3aff4e63a7e38bef42d469bafd1ed7c1cc1a2.png
    `-- e952cfd4c1bc58e77024e4c2b518531356319780.png

Here is what the backup tarball contains:

/tmp# tar tvzf ask-tunisians-2020-07-28-042934-v20200728004302.tar.gz 
-rw-r--r-- discourse/www-data 11767008 2020-07-28 04:29 dump.sql.gz
drwxr-xr-x discourse/www-data        0 2020-07-26 21:11 var/www/discourse/public/uploads/default/
drwxr-xr-x discourse/www-data        0 2020-07-26 21:11 var/www/discourse/public/uploads/default/original/
drwxr-xr-x discourse/www-data        0 2020-07-27 20:33 var/www/discourse/public/uploads/default/original/1X/
-rw-r--r-- discourse/www-data    14843 2020-07-26 21:56 var/www/discourse/public/uploads/default/original/1X/7835873085d7323b640c2504cd737b51f370360f.png
-rw-r--r-- discourse/www-data     9039 2020-07-27 20:33 var/www/discourse/public/uploads/default/original/1X/75a192f211147f512bdddabaf50addd43c6a9d86.png
-rw-r--r-- discourse/www-data     5783 2020-07-26 21:56 var/www/discourse/public/uploads/default/original/1X/19629775936660ecc73235158b4d68b9ec4b2abe.png
-rw-r--r-- discourse/www-data    11124 2020-07-26 21:11 var/www/discourse/public/uploads/default/original/1X/e952cfd4c1bc58e77024e4c2b518531356319780.png
-rw-r--r-- discourse/www-data    35570 2020-07-26 21:11 var/www/discourse/public/uploads/default/original/1X/52b3aff4e63a7e38bef42d469bafd1ed7c1cc1a2.png
-rw-r--r-- discourse/www-data     2375 2020-07-26 21:56 var/www/discourse/public/uploads/default/original/1X/d4af3550a7c3f857c974b996257c8e3db72e7850.png
-rw-r--r-- discourse/www-data     9759 2020-07-26 22:14 var/www/discourse/public/uploads/default/original/1X/dfc47da4c22ffeddf59f736a46a2c50ee55d7fa1.png
-rw-r--r-- discourse/www-data    24898 2020-07-26 21:46 var/www/discourse/public/uploads/default/original/1X/d832b24f2cb338139984be98045d22e0af093c4a.png

Clearly, the images were there, but I suppose the question is: why were most of the images not copied over correctly as part of the restore operation?