[openstreetmap/openstreetmap-website] Adds checking if trace files have GPX extensions (PR #5117)

Andy Allan notifications at github.com
Wed Aug 28 13:06:53 UTC 2024


> I apologize for this mistake .. I forgot the archives types. Just to be sure, are these file formats (I collected list from Trace.rb: ".tar.gz", ".tar.bz2", ".tar", ".zip", ".gpx.gz", ".gpx.bz2", ".gpx") the only supported or there are more (.json, .csv, ..)?

We don't use filenames to detect what type of file has been uploaded. Extensions are optional and shouldn't be used for filtering. If you have a file called "some_trace" then we will detect if it is an archive (using `/usr/bin/file`, a compressed archive, or similar, and handle it appropriately.

The `extension_name` is used when you are later downloading a trace that was successfully imported - we will synthesis a name for the file based on the trace id, and then pick an appropriate extension based on the format of the file, again using `/usr/bin/file` for detection.

We can certainly improve the error handling for when someone uploads a file that can't be parsed!



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

Message ID: <openstreetmap/openstreetmap-website/pull/5117/c2315269892 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20240828/cc9c6965/attachment.htm>


More information about the rails-dev mailing list