Cannot view attachments after import

AI-generated summary

The discussion revolves around resolving issues with viewing attachments after importing from phpBB to Discourse. The Problem: Imported attachments have a local URL, but the system stores them in S3, resulting in a 404 error when trying to download. mattbr has tried changing permissions and manually modifying the href but encountered another issue. pmusaraj suggests running the uploads:migrate_to_s3 rake task to fix the problem. mattbr confirms that running the task resolves the issue, by executing the following commands:

cd /var/discourse
sudo ./launcher enter app
rake uploads:migrate_to_s3

Hi,

I have followed this guide to import from phpBB: Migrate a phpBB3 forum to Discourse

I am now using S3 to store user attachments, and all attachments after an import work. The posts href looks like: https://{MY_S3_BUCKET}.s3.amazonaws.com/original/2X/8/{HASH}.zip

However all imported attachments href looks like: https://{MY_WEBSITE}/uploads/default/original/2X/6/{HASH}.zip

When I SSH onto the machine I can see this attachment lives:
/var/discourse/shared/standalone/uploads/default/original/2X/6/{HASH}.zip but when I click on the link to download the file from my forums instance it results in a 404 page.

I have checked the permissions and even ran chmod 777 {HASH}.zip however it still keeps 404ing when trying to download.

I can resolve this by manually modifying the href in these posts to refer to the S3 bucket, however it will lead to a page that says:

We were unable to verify that the link you selected was actually posted to the forum. If you wish to proceed anyway, select the link below.

Any ideas on how to resolve this and allow all import attachments to work? They exist both in S3 and on the local machine as well.

Thanks,

  • Matt

You can likely fix this by running the uploads:migrate_to_s3 rake task.

I’ll try that and report back, thank you!

EDIT: Confirmed that running the following commands resolves this issue:

cd /var/discourse
sudo ./launcher enter app
rake uploads:migrate_to_s3