This PR compresses plain GPX files before they go to S3. This should cut a 
large part of the size of plain GPX files.

Files that are already compressed (gzip, bzip2, zip, tar) are left as is.

For new uploads, the file comes back as <id>.gpx.gz, no longer as plain GPX. 
The problem is for Windows users, where .gz is not supported unless they 
install 7-Zip. To handle this, I have added two links to download . One gives 
the plain GPX and the other gives the compressed file. I did not add new 
decompression code. I reused the 
[xml_file](https://github.com/openstreetmap/openstreetmap-website/blob/master/app/models/trace.rb#L187-L199)
 function that already decompresses the trace, and linked the plain GPX option 
to it.

Results:

<img width="794" height="703" alt="image" 
src="https://github.com/user-attachments/assets/c66abc81-54d2-48bb-af4b-d33a2789afbd";
 />



Ref: https://github.com/openstreetmap/openstreetmap-website/issues/4188

cc. @1ec5 
You can view, comment on, or merge this pull request online at:

  https://github.com/openstreetmap/openstreetmap-website/pull/7124

-- Commit Summary --

  * Compress plain GPX uploads with gzip
  * Update mime type and extension tests
  * Add plain gpx/compress download link for traces

-- File Changes --

    M app/models/trace.rb (26)
    M app/views/traces/show.html.erb (2)
    M config/locales/en.yml (3)
    M test/models/trace_test.rb (10)

-- Patch Links --

https://github.com/openstreetmap/openstreetmap-website/pull/7124.patch
https://github.com/openstreetmap/openstreetmap-website/pull/7124.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/7124
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/[email protected]>
_______________________________________________
rails-dev mailing list
[email protected]
https://lists.openstreetmap.org/listinfo/rails-dev

Reply via email to