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

Handle multiple tags when splitting up in tag editor #6211

Merged
merged 3 commits into from
Apr 23, 2019

Conversation

AndreasHae
Copy link
Contributor

As requested by @tordans in #5070 and #6185:

When pasting multiple tags like "amenity=restaurant name=The Restaurant", they shall be split up and added separately. My implementation assumes that there will never be spaces in keys, so it also handles cases like "name=The Restaurant amenity=restaurant" correctly, and splits it up at the last space before the key.

@AndreasHae
Copy link
Contributor Author

Huh, seems like the build system complains about missing semicolons, although they are present.

@bhousel
Copy link
Member

bhousel commented Apr 22, 2019

Huh, seems like the build system complains about missing semicolons, although they are present.

You need to put them in the anonymous functions too.. for example:

list.map(function(item) { return item.trim(); });

@tordans
Copy link
Collaborator

tordans commented Apr 22, 2019

@AndrewHain <3

Will it also work if I copy multi line key-value pairs which are something like key=value\nkey2=value2 (\n meaning "however JS "sees" a line break). (I am bad at reading regex.)

@AndreasHae
Copy link
Contributor Author

Oh, thanks @bhousel! Didn't see them.. What's weird though is that the build passed just fine for me locally.

@AndreasHae
Copy link
Contributor Author

AndreasHae commented Apr 22, 2019

@tordans yes, that works!

@quincylvania
Copy link
Collaborator

What's weird though is that the build passed just fine for me locally.

@AndreasHae You need to run npm run lint to see some syntax errors like missing semicolons that the build and mocha tests won't catch.

@slhh
Copy link
Contributor

slhh commented Apr 22, 2019

@AndreasHae
Assuming no spaces in keys seems to be ok, but in addition you are likely assuming no equal signs in values, which could for example fail in case of URLs, conditional restrictions (operators =, <=, >=), strange names. I think a space is insufficient to separate tags.

@AndreasHae
Copy link
Contributor Author

Good point @slhh.
Do you think I should limit the splitting only to newlines?

@bhousel
Copy link
Member

bhousel commented Apr 23, 2019

Thanks @AndreasHae - this looks ok 👍

@bhousel bhousel merged commit 1d4770a into openstreetmap:master Apr 23, 2019
bhousel added a commit that referenced this pull request May 2, 2019
(Reverts: #6211, #5070, #5024)

The old code allows users to circumvent the readonly tag protection
see #6185 (comment)

We'll offer a text-mode instead, with stricter checks on which keys can be modified.
@quincylvania quincylvania added this to the 2.15.0 milestone May 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants