[openstreetmap/openstreetmap-website] Map XML download with Turbo (PR #6255)

Tom Hughes notifications at github.com
Sun Jul 27 08:53:35 UTC 2025


@tomhughes commented on this pull request.



> +      try {
+        detailMessage = event?.detail?.error?.message;
+        if (!detailMessage) {
+          const responseText = await event.detail.fetchResponse.responseText;
+          const parser = new DOMParser();
+          const doc = parser.parseFromString(responseText, "text/html");
+          detailMessage = doc.body ? doc.body.textContent.trim() : "(unknown)";
+        }
+      } catch (err) {
+        detailMessage = "(unknown)";
+      }
+      // eslint-disable-next-line no-alert
+      alert(OSM.i18n.t("javascripts.share.export_failed", { reason: detailMessage }));
+    }
+
+    static getTurboBlobHandler(downloadCallback) {

This is setup to return a function that captures the callback but in fact both users are using very similar callbacks - in particular they are both just forwarding to `OSM.downloadBlob`.

So wouldn't make more sense for this just to take the filename (which is the only thing that changes and needs to be captured) and put the `downloadBlob` call in here?

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

Message ID: <openstreetmap/openstreetmap-website/pull/6255/review/3059419928 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250727/b2bbd53a/attachment.htm>


More information about the rails-dev mailing list