[openstreetmap/openstreetmap-website] Image download with user feedback (PR #6192)

mmd notifications at github.com
Sat Jul 19 12:49:58 UTC 2025


@mmd-osm commented on this pull request.



> +          const contentType = blob.type;
+          let extension = "bin";
+          if (contentType === "image/png") extension = "png";
+          else if (contentType === "image/jpeg") extension = "jpg";
+          else if (contentType === "image/svg+xml") extension = "svg";
+          else if (contentType === "image/webp") extension = "webp";
+          else if (contentType === "application/pdf") extension = "pdf";
+          a.download = `map.${extension}`;

Maybe I'm missing something here. blob.type contains a mime type at this point which I'm mapping to a file suffix. Also, the url doesn't have any suffix. How would an automatic determination work here?

<img width="690" height="148" alt="Image" src="https://github.com/user-attachments/assets/45ce9f37-ca63-4764-861a-64a6ff766952" />

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

Message ID: <openstreetmap/openstreetmap-website/pull/6192/review/3035366127 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250719/f2b6993d/attachment.htm>


More information about the rails-dev mailing list