Modify

Opened 3 years ago

Last modified 5 months ago

#21597 new defect

[patch] Zero-width space when copy/pasting URL from Notes

Reported by: mnalis Owned by: team
Priority: normal Milestone:
Component: Core notes Version: tested
Keywords: template_report Cc:

Description (last modified by gaben)

What steps will reproduce the problem?

  1. click on the Note containing URL (eg. note/2860251)
  2. select URL in JOSM Note window, and press ctrl-C to copy it
  3. paste URL in web browser (firefox) URL bar with ctrl-v

What is the expected result?

I would expect URL I see on screen in JOSM (eg. "https://westnordost.de/​p/61107.jpg") to be pasted

What happens instead?

URL containing invalid/nonexistent character is pasted, eg. "https://westnordost.de/%E2%80%8Bp/61107.jpg"

Please provide any additional information below. Attach a screenshot if possible.

When I click on the note (for example Note 2860251) window with its description appears. It contains clickable URL (which I sometimes cannot click, due to other bug coming soon). URL looks normal visually for example "https://westnordost.de/​p/61107.jpg", however, when it is pasted in browser window it becomes this:
https://westnordost.de/%E2%80%8Bp/61107.jpg which is wrong and doesn't work.

Looking around (https://stackoverflow.com/a/63187080/2600099), it seems that "E2 80 8B" is UTF-8 "zero-width space", which incorrectly gets inserted somehow.

Looking at the original Note in Notes dump, it looks the note is correctly stored in OSM database, so it is likely that something that JOSM does which causes the corruption:

% curl -sL https://planet.openstreetmap.org/notes/planet-notes-latest.osn.bz2 | bzip2 -dc | env -i LC_ALL=C fgrep https://westnordost.de/ | fgrep /61107.jpg | hd
00000000  68 74 74 70 73 3a 2f 2f  77 65 73 74 6e 6f 72 64  |https://westnord|
00000010  6f 73 74 2e 64 65 2f 70  2f 36 31 31 30 37 2e 6a  |ost.de/p/61107.j|
00000020  70 67 3c 2f 63 6f 6d 6d  65 6e 74 3e 0a           |pg</comment>.|
0000002d

Possibly related: https://josm.openstreetmap.de/ticket/19616

Original issue reported at: https://github.com/streetcomplete/StreetComplete/issues/3439

Relative:URL: ^/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2021-11-01 23:05:46 +0100 (Mon, 01 Nov 2021)
Revision:18303
Build-Date:2021-11-01 22:25:18
URL:https://josm.openstreetmap.de/svn/trunk

Identification: JOSM/1.5 (18303 en) Linux Debian GNU/Linux 11 (bullseye)
Memory Usage: 612 MB / 1456 MB (118 MB allocated, but free)
Java version: 11.0.13+8-post-Debian-1deb11u1, Debian, OpenJDK 64-Bit Server VM
Look and Feel: javax.swing.plaf.metal.MetalLookAndFeel
Screen: :0.0 1920×1080 (scaling 1.00×1.00)
Maximum Screen Size: 1920×1080
Best cursor sizes: 16×16→16×16, 32×32→32×32
Environment variable LANG: C.UTF-8
System property file.encoding: UTF-8
System property sun.jnu.encoding: UTF-8
Locale info: en
Numbers with default locale: 1234567890 -> 1234567890
Desktop environment: ICEWM
Java package: openjdk-11-jre:amd64-11.0.13+8-1~deb11u1
WebStart package: icedtea-netx:all-1.8.4-1
libcommons-compress-java: libcommons-compress-java:all-1.20-1
fonts-noto: fonts-noto:all-20201225-1
liboauth-signpost-java: liboauth-signpost-java:all-1.2.1.2-3
VM arguments: [--patch-module=java.desktop=/usr/share/icedtea-web/javaws.jar:, --add-reads=java.base=ALL-UNNAMED,java.desktop, --add-reads=java.desktop=ALL-UNNAMED,java.naming, --add-reads=java.naming=ALL-UNNAMED,java.desktop, --add-exports=java.desktop/sun.awt=ALL-UNNAMED,java.desktop, --add-exports=java.desktop/javax.jnlp=ALL-UNNAMED,java.desktop, --add-exports=java.base/com.sun.net.ssl.internal.ssl=ALL-UNNAMED,java.desktop, --add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED,java.desktop, --add-exports=java.base/sun.security.action=ALL-UNNAMED,java.desktop, --add-exports=java.base/sun.security.provider=ALL-UNNAMED,java.desktop, --add-exports=java.base/sun.security.util=ALL-UNNAMED,java.desktop, --add-exports=java.base/sun.security.validator=ALL-UNNAMED,java.desktop, --add-exports=java.base/sun.security.x509=ALL-UNNAMED,java.desktop, --add-exports=java.base/jdk.internal.util.jar=ALL-UNNAMED,java.desktop, --add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED,java.desktop, --add-exports=java.desktop/sun.awt.X11=ALL-UNNAMED,java.desktop, --add-exports=java.desktop/sun.applet=ALL-UNNAMED,java.desktop, --add-exports=java.desktop/sun.applet=ALL-UNNAMED,jdk.jsobject, --add-exports=java.naming/com.sun.jndi.toolkit.url=ALL-UNNAMED,java.desktop, -Dicedtea-web.bin.name=javaws, -Dicedtea-web.bin.location=/usr/share/icedtea-web/bin/javaws.sh, -Djava.security.manager, -Djava.security.policy=/etc/icedtea-web/javaws.policy]
Dataset consistency test: No problems found

Plugins:
+ DirectUpload (35858)
+ apache-commons (35524)
+ buildings_tools (35823)
+ conflation (0.6.8)
+ ext_tools (35640)
+ imagery_offset_db (35640)
+ jts (35458)
+ pt_assistant (1ff2e15)
+ reverter (35846)
+ turnrestrictions (35640)
+ utilsplugin2 (35856)

Tagging presets:
+ https://<user.name>.com/prezentacije/OpenStreetMap/josm-preset.xml
+ https://raw.githubusercontent.com/OpenNauticalChart/josm/master/INT-1-preset.xml

Map paint styles:
- https://josm.openstreetmap.de/josmfile?page=Styles/PublicTransport&zip=1
+ http://bezdomni.net/Styles_HighlightedCapesBays-style.mapcss
+ https://josm.openstreetmap.de/josmfile?page=Styles/ColorWays&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/Coloured_Streets&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/Fixme&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/Modified&zip=1

Validator rules:
+ https://josm.openstreetmap.de/josmfile?page=Rules/KeepRight&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Rules/QAToolInspiredValidations&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Rules/OSMLint&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Rules/MissingWeekdays&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Rules/SourceObjectTag&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Rules/IndoorRules&zip=1

Last errors/warnings:
- 05014.973 E: java.nio.file.AccessDeniedException: ${HOME}/tmp/g/1/prvic_20210913.osm~
- 05023.425 E: java.nio.file.AccessDeniedException: ${HOME}/tmp/g/1/prvic_20210913.osm~

Attachments (1)

21597.patch (2.9 KB ) - added by taylor.smock 2 years ago.
Unwrap long url when getting text from HTML document

Download all attachments as: .zip

Change History (12)

comment:1 by skyper, 3 years ago

See also #21593.

comment:2 by mnalis, 3 years ago

Description: modified (diff)

comment:3 by mnalis, 3 years ago

Description: modified (diff)

comment:4 by skyper, 3 years ago

Please check the note id. note/286025 does not include an url.

comment:5 by mnalis, 3 years ago

Description: modified (diff)

comment:6 by mnalis, 3 years ago

Description: modified (diff)

ops, sorry, lost one char when copy/pasting, it is https://www.openstreetmap.org/note/2860251.

Although that one is now closed, but https://www.openstreetmap.org/note/2223527 nearby is an open note with same problem (link gets mungled to https://westnordost.de/%E2%80%8Bp/18249.jpg)

comment:7 by skyper, 3 years ago

Thanks, I can reproduce. All urls are affected:

Directly copied with select all plus copy from context menu:

Note 2860251 mnalis ALTernative on Sep 19, 2021: Unable to answer "What is the name of this place? (Marketplace)" for https://osm.org/​way/​816605805 via StreetComplete 34.0: facebook vidi Attached photo(s): https://westnordost.de/​p/61107.jpg Matija Nalis on Nov 24, 2021: ucrtano

Same in vim:

Note 2860251 mnalis ALTernative on Sep 19, 2021: Unable to answer "What is the name of this place? (Marketplace)" for https://osm.org/<200b>way/<200b>816605805 via StreetComplete 34.0: facebook vidi Attached photo(s): https://westnordost.de/<200b>p/61107.jpg Matija Nalis on Nov 24, 2021: ucrtano

comment:8 by gaben, 3 years ago

Description: modified (diff)

add link

comment:9 by gaben, 3 years ago

The zero-width space added to prevent overflow of long URLs, see NoteLayer.java. I think the whole note tooltip implementation needs an overhaul. See also ticket:21593#comment:5.

Last edited 3 years ago by gaben (previous) (diff)

by taylor.smock, 2 years ago

Attachment: 21597.patch added

Unwrap long url when getting text from HTML document

comment:10 by taylor.smock, 2 years ago

I'm not a big fan of what I did in attachment:21597.patch, mostly because it relies upon the caller to do the URL wrapping themselves. It works, but I don't like it.

comment:11 by gaben, 5 months ago

Summary: Zero-width space when copy/pasting URL from Notes[patch] Zero-width space when copy/pasting URL from Notes

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain team.
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from team to the specified user.
Next status will be 'needinfo'. The owner will be changed from team to mnalis.
as duplicate The resolution will be set to duplicate. Next status will be 'closed'. The specified ticket will be cross-referenced with this ticket.
The owner will be changed from team to anonymous. Next status will be 'assigned'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.