Add missing characters to URL regex #4710
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added the unreserved character ~ and the reserved characters '(), to the URL matching regex. If I'm understanding RFC 3986 correctly, "reserved" characters are allowed unencoded in URIs (& there already exist some of these characters in the regex) and so are "unreserved" characters like ~.
The tilde looks like its an unsafe character to have unencoded in RFC 1738, though it appears this is now superseded in most applications - and regardless, if this regex is only used to determine if a link is clickable I don't think there's much harm in including it. I'd love to get some more opinions on this.
This should fix #4705 and improve detection of clickable URLs. I have checked that this is the only place this REGEX string is used but since this is my first contribution, please can someone else check this as well.
Changelog(Fixes): Fixed an issue where URLs in JSON responses were not properly clickable if they included certain unreserved characters