@AntonKhorev commented on this pull request.


> @@ -121,6 +135,30 @@ OSM = {
     return mapParams;
   },
 
+  parseGeoURI: function (geoURI) {
+    if (typeof geoURI !== "string") return;
+    let url;
+    try {
+      url = new URL(geoURI.toLowerCase());
+    } catch (e) { return; }
+    if (url.protocol !== "geo:" || !url.pathname) return;
+    const [path, ...params] = url.pathname.split(";");
+    let coords;
+    try {
+      coords = L.latLng(path.split(","));
+    } catch (e) { return; }
+    if (!coords) return;
+    const searchParams = new URLSearchParams(params.join("&"));

I checked Google Maps and looks like `z` is case sensitive, so it's better to 
move `toLowerCase` here:

```suggestion
    const searchParams = new URLSearchParams(params.join("&").toLowerCase());
```

`url.protocol !== "geo:"` should still work because the `URL` class converts it 
to lowecase on its own.

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

Message ID: 
<openstreetmap/openstreetmap-website/pull/5736/review/2794493...@github.com>
_______________________________________________
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev

Reply via email to