fix: decode file URIs in document hyperlink labels#1422
fix: decode file URIs in document hyperlink labels#1422sebthom merged 1 commit intoeclipse-lsp4e:mainfrom
Conversation
DocumentLinkDetector now derives the hyperlink label from the decoded URI path for file:// links, so percent-encoded characters (e.g. %C3%A9) are shown as their human-readable form while still opening the original URI.
| if (uri.isEmpty()) | ||
| return uri; | ||
|
|
||
| if (uri.startsWith(LSPEclipseUtils.FILE_URI)) { |
There was a problem hiding this comment.
what about decoding other URIs?
There was a problem hiding this comment.
Decode them to what? Here we turn file URLs in readable file paths.
There was a problem hiding this comment.
Is that still a valid URL? here we convert from valid but barely readable URL to readable and valid local file path.
There was a problem hiding this comment.
What do you mean by valid? It is the same one, just decoded. Do you mean by valid that you can copy it and pasten into a "browser", then I think not, but the same would be valid for the path. Since this is meant to be shown to the user, not as an input for a browser, I think this should be better that showing the encoded URL, shouldn't it?
There was a problem hiding this comment.
I thought we should only decode if the decoded form is directly usable by the end user which in case of local files seems obvious. But I don't have a strong preference if we should or should not do the same for other types of URLs.
There was a problem hiding this comment.
I thought we should only decode if the decoded form is directly usable by the end user which in case of local files seems obvious. But I don't have a strong preference if we should or should not do the same for other types of URLs.
DocumentLinkDetector now derives the hyperlink label from the decoded URI path for file:// links, so percent-encoded characters (e.g. %C3%A9) are shown as their human-readable form while still opening the original URI.
Fixes #474