openstreetmap / iD

🆔 The easy-to-use OpenStreetMap editor in JavaScript.
https://www.openstreetmap.org/edit?editor=id
ISC License
3.29k stars 1.19k forks source link

Autofix makes wikimedia_commons file unreachable #10206

Open ivanbranco opened 2 months ago

ivanbranco commented 2 months ago

URL

https://www.openstreetmap.org/node/2331525071/history

How to reproduce the issue?

  1. Add a space, changing "7,;Po" into "7,; Po"
  2. iD automatically deletes the space, linking a non-existent file (this) instead of the correct one (this).

Screenshot(s) or anything else?

This happens because ";" is allowed in Wikimedia Commons filenames, this is why using it as separator in this tag is discouraged in the wiki:

Note that adding several files separated by a semi-colon value separator (the ; character) is discouraged because it's a character allowed in Wikimedia Commons filenames, such as "File:Podlaskie - Białystok - Białystok - Raginisa 8 - cm Farny - kościół Chrystusa Zbawiciela - Front;daleko.jpg" (currently used on OpenStreetMap[2]). So a client would have no way of knowing whether a semicolon represents a real semicolon in the file name or a separator between file names, so it follows the specification and treats it as part of the file name (as Overpass, the OSM website and Usage Bot do). This also makes difficult to identify broken links (because of typos or deletions) with external tools. If more images are available, just add the "best" one or create a new Wikimedia Commons gallery.

Which deployed environments do you see the issue in?

Released version at openstreetmap.org/edit

What version numbers does this issue effect?

2.28.1

Which browsers are you seeing this problem on?

Chrome

1ec5 commented 2 months ago

There are rare but documented escape sequences for semicolons. Maybe the semicolon should be escaped inside a tagged Commons file or page name to avoid this ambiguity. iD could add support for either escape sequence pretty easily.