Broken pipe error when uploading to a S3 clone, a pdf with a name containing é,ï etc

latest app, I rebuilt an hour ago, I can’t repro on meta, I assume it has to do with French localization.

I have a broken pipe error when I try to upload a pdf name laïcité.pdf but the same one renamed laicite.pdf works fine.
laïcité.jpg works also fine.

something named décroissance.pdf gives a different error “we encountered an internal error. please try again.” :face_with_raised_eyebrow:

ps. Not sure if it’s pertinent, I also use an S3 clone (scaleway) which also gave me a broken pipe error when I tried rake uploads.migrate_to_s3, but feels unrelated.

pps. yep… it might be related to the S3 clone upload, I checked I have a 3 weeks old upload with an accent, just prior of the enabling of the S3 upload option :roll_eyes:

1 Like

Line 62 of https://github.com/discourse/discourse/blob/master/lib/file_store/s3_store.rb

options[:content_disposition] = "attachment; filename=\"#{filename}\""

the content disposition should perhaps be formated

options[:content_disposition] = ActionDispatch::Http::ContentDisposition.format(
        disposition: "attachment", filename: upload.filename
      )

as in
https://github.com/discourse/discourse/commit/24877a7b8c3aa445f0969b298ba8a34ac57c7bd6

if so, maybe these content_disposition too:
https://github.com/discourse/discourse/commit/e5da2d24e543c86868768de235b8eedab1ee6ee1

4 Likes

I think you are right, these kind of issues with filenames always slip my mind. I should be able to get a PR up to fix this tomorrow. Thanks for the report!

4 Likes

Fix building here which will land soon. Tested with the pdf file name above and it is working fine :ok_hand:. The fix will land soon!

3 Likes