Opened 8 years ago
#14490 new enhancement
Support for escaping pipe character in remote control addtags parameters
Reported by: | SanderH | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Core remotecontrol | Version: | |
Keywords: | template_report | Cc: |
Description
What steps will reproduce the problem?
- Follow a link with the | escaped (suggest \|) like: https://localhost:8112/load_object?new_layer=true&objects=n123456&addtags=test%3Atag1=true%7C%5C%7Ctest%3Atag2=true%7Ctest%3Atag3=contains%5C%7Cpipe
What is the expected result?
JOSM should add the tags "test:tag1=true", "|test:tag2=true" and "test:tag3=contains|pipe"
What happens instead?
JOSM add the tags "test:tag1=true", "test:tag2=true" and "test:tag3=contains\"
So with tag2, the preceding pipe is lost in the tag name and with tag3 the tag value is cut off.
Please provide any additional information below. Attach a screenshot if possible.
For an existing plugin (https://github.com/gidema/josm-ods-bag) we're using some temporary tags to make better selections in JOSM which will be removed by the plugin before uploading. The tags used happen to start with a pipe symbol. Without a way to escape the pipe character I cannot add some tags so a list of objects.
I also noticed that the data cannot contain pipes, so it makes sense to enhance the behavior.
Seems that changing the split in https://josm.openstreetmap.de/browser/josm/trunk/src/org/openstreetmap/josm/io/remotecontrol/AddTagsDialog.java?rev=10973#L272 to one using a Pattern.quote (http://stackoverflow.com/questions/18677762/handling-delimiter-with-escape-characters-in-java-string-split-method) should do the trick.