Attachments uploaded to S3 404 on a new server

UPDATE:
I found this
Attachments are not being saved in S3

But when I migrate the server, these are not available, they result in a 404.
See below # New Discovery, I’m leaving the OP just in case it helps.

Original Post

I am working on migrating a server from one place to another.
There is S3 and a CDN configured and most uploads seem to work fine.
In the process of the migration I noticed a specific kind of attachment is not uploaded to S3:

I tried:

root@discourse-app: /var/www/discourse# rake uploads:analyze_missing_s3
List of posts with missing images:
Total missing uploads: 0, newest is 
Total problem posts: 0 with 0 missing uploads
Other missing uploads count: 0

When I go under /var/discourse/shared/standalone/uploads:

root@discourse:/var/discourse/shared/standalone/uploads$ ls -lhAR
total 4.0K
drwxr-xr-x 3 nosferatu www-data 4.0K Jan  8  2024 csv_exports

./csv_exports:
total 4.0K
drwxr-xr-x 2 nosferatu www-data 4.0K Aug 21 00:45 default

./csv_exports/default:
total 0

I can only find:

root@discourse:/var/discourse/shared/standalone/uploads$ locate .funscript                                                                                        
/var/lib/docker/overlay2/3cc16f26278c625a5321f97cdc25e75e82c5a222ac7a9310e0a9ae24386777d8/diff/var/www/discourse/tmp/download_cache/031cb76f4769f63c6733bb3ef78ca520dbb11b89.funscript       
/var/lib/docker/overlay2/3cc16f26278c625a5321f97cdc25e75e82c5a222ac7a9310e0a9ae24386777d8/diff/var/www/discourse/tmp/download_cache/0e7f3157d4b26e7600a04b19d8e49b4f97391f44.funscript
...

When I check the S3 storage, there is no such files by those names.
I have no idea where these files are stored.

New discovery

As mentioned above, I found why the links behave the way they do.
But now when I redeploy a server with the following steps:

  1. Spin up discourse
  2. Restore from sql.gz in Admin > Backups > Restore

When I try to download an attachment, it 404s.