REPRODUCIBILITY: 100% (always)
OSVERSION: 4.4.0.72
HARDWARE: Sony Xperia 10 III - xqbt52 - xqbt52 - 1.0.0.176 - aarch64
UI LANGUAGE: English (UK) (user: en_GB, os: en_GB.utf8)
REGRESSION: no
DESCRIPTION:
4.4.0.72 introduced the ability to copy URLs to clipboard quickly.
However the URL is copied literally, which causes problems when pasting, e.g. if the URI contains space characters.
PRECONDITIONS:
STEPS TO REPRODUCE:
Browse to an URL with spaces (or other characters which break an URL)
Long press location bar to copy to clipboard
Paste clipboard somewhere
Try to open the pasted link
EXPECTED RESULTS:
Pasted URL should open
ACTUAL RESULTS:
Link is likely to not work correctly, depending on whether the app receiving the URL sanitizes the link or not.
FWIW that is the same behaviour as copying the address the old way.
It would be very confusing if they behaved differently.
I’m not disagreeing with that it would be handy (at least sometimes), but is there precedent for that it should work that way?
Edit: my desktop browser seems to do it after all, so i guess it is convention.
It’s not just convention, that is the actual URL. Browsers will ‘helpfully’ hide the ‘scary details’ from you when displaying a URL. But a URL (URI) can only use a limited set of characters directly, every character in the URL not in this ‘safe’ set has to be percent encoded. Spaces for example are not in the safe set, and therefore must be percent encoded.
So when you copy a URL and it is not percent encoded, what you have is no longer a URL.
This is one solution and would have the same end result, but probably the wrong value is being used to start with. I.e. instead of requesting the ‘display form’ from the browser, the ‘url form’ should be requested directly so that the roundtrip URL → displayable text → URL is avoided.
I guess, but AFAIK WebView does not expose the ‘internal’ variant, (or it is implicitly decoded on url->string conversion), anyway this is the relevant bit in the QML, hence my suggestion to use the JS encodeURI function:
Thanks for suggesting this @nephros, and then for fixing it! As your PR has been merged, I’ve tagged it as fixed, as in theory it should make it into the next major release. Great work!