@Rub21 commented on this pull request.
> @@ -76,10 +78,26 @@ def tagstring=(s)
def file=(attachable)
case attachable
when ActionDispatch::Http::UploadedFile, Rack::Test::UploadedFile
- super(:io => attachable,
- :filename => attachable.original_filename,
- :content_type => content_type(attachable.path),
- :identify => false)
+ type = content_type(attachable.path)
+
+ if type == "application/gpx+xml"
+ # Gzip plain GPX before upload to S3
+ gz = Tempfile.new(["trace", ".gpx.gz"])
A block doesn't work here. Active Storage uploads on save and reads the file
again then, so it needs to stay open until that point. Instead I unlink the
temp file right after writing it. It's gone from disk, but the open handle
still works for the upload. Same as xml_file function uses.
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/7124#discussion_r3365855825
You are receiving this because you are subscribed to this thread.
Message ID:
<openstreetmap/openstreetmap-website/pull/7124/review/[email protected]>_______________________________________________
rails-dev mailing list
[email protected]
https://lists.openstreetmap.org/listinfo/rails-dev