martinpaljak / nfc4pc

NFC for Personal Computers
https://superuser.com/questions/1756090/how-to-open-nfc-tags-on-windows-like-a-mobile-phone-would
GNU General Public License v3.0
14 stars 0 forks source link

URl gets doubleencoded #8

Open ybuechler opened 10 months ago

ybuechler commented 10 months ago

When using Meta-URL the URL Parameter 'url' gets encoded into URL String twice. This results in an wrong encoding

Example: URL to encode: https://google.com correctly encoded URL: https%3A%2F%2Fgoogle.com Encoding from this tool: https%253A%252F%252Fgoogle.com

Maybe it is resulting from this issue: https://bz.apache.org/bugzilla/show_bug.cgi?id=39746

Workaround for me is to decode the URL twice on the receiving end.

Without checking the code out. Maybe the issue is in the class "NFC4PC" where you encode the URL on Line 153 and then add it to the URL with the method "appendUri" in that method you write that the append String will be URL encoded. That would mean that the URL gets encoded twice and would explain the behaviour.

martinpaljak commented 10 months ago

Confirmed. Not related to the mentioned issue, comes from Java.

martinpaljak commented 10 months ago

OK. It seems that according to all RFC-s etc (nice rabbithole), the URL should not be encoded at all. Which is also the behaviour coming out of Java URI methods by default. So I'll remove the encoding (which results in double encoding, as % is special), but this also means that you need to be able to handle