Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iD editor just recently broke: regex problem #9163

Closed
hobbit-ns opened this issue Jun 15, 2022 · 2 comments · Fixed by #9165
Closed

iD editor just recently broke: regex problem #9163

hobbit-ns opened this issue Jun 15, 2022 · 2 comments · Fixed by #9165
Labels
bug-browser-specific A bug that only appears in certain browsers

Comments

@hobbit-ns
Copy link

URL

[any editing link]

How to reproduce the issue?

Is this even the right place to report bugs? I can only repost what I put in one of the forums and hope the right eyeballs see it:

Sometime between 1 - 2 months ago when I last edited and now, the in-browser editor has been rendered nonfunctional for me. The problem I can dig up in the debugger reads thusly:

   SyntaxError: invalid regular expression flag s
   id-6172ebd02911868e7b330b540a9baa13d0fcf18c6f57ad447234ca1ec33f4e0f.js:11:8250

in file
https://www.openstreetmap.org/assets/id-6172ebd02911868e7b330b540a9baa13d0fcf18c6f57ad447234ca1ec33f4e0f.js,
the code fragment in question reads

   {var n=o.replace(/#.*/us,"");

"s" is a rather recent regex modifier, and is NOT guaranteed to be present in some number of even recent-ish vintage browsers. It's not even shown at regex101.com yet, a very common go-to reference. This gratuitous type of change has probably broken functionality for a lot of people, who are perhaps not at liberty to rip up their whole browser environment for a bleeding-edge upgrade they don't need.

The workaround for the functionality of the "s" flag is to use '[\s\S]' instead of '.', then matching works across newlines. Someone should FIX this, if they care about keeping the community accomodating and welcome. Coming home from an afternoon of mapping trails that aren't in the database yet, being blocked from adding them is not exactly what I expected.

After a bit of research, I confirmed that the regex "s" flag fails on firefox 78, and works okay on firefox 91ESR which I am able to run in a very limited test environment. This is still suboptimal, and doesn't help anybody with a browser that's not even all that old, but unable to upgrade for any of a host of reasons. Please just make the code a little better WRT backward-compatibility.

If this wasn't the right way to report this, someone more familiar with github please move it appropriately.

_H*

Screenshot(s) or anything else?

No response

Which iD Editor versions do you see the issue on?

Released version at openstreetmap.org/edit

Which browsers are you seeing this problem on?

Firefox

@1ec5
Copy link
Collaborator

1ec5 commented Jun 15, 2022

Hi, thanks for taking the time to report this issue. I know how frustrating it can be to get blocked from mapping for such a small reason.

I can reproduce the error in older versions of Firefox. This regular expression was introduced in 352f244, released a couple weeks ago and deployed to the website last week in openstreetmap/openstreetmap-website#3561. This release intentionally dropped support for Internet Explorer 11 (#8811), but I don’t see any documentation about which other browser versions this project intends to support. The workaround is suitable in any case; see #9165.

@tyrasd tyrasd added the bug-browser-specific A bug that only appears in certain browsers label Jun 15, 2022
@hobbit-ns
Copy link
Author

Excellent, thanks very much!

_H*

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-browser-specific A bug that only appears in certain browsers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants