Repository navigation
Treat | as a stop character on the right side of URL - #171
Merged
Merged
Conversation
Jira/Confluence style links like [url|url|smart-link] were extracted as one long URL including the pipes and the label. | was already a left stop char but not a right one, and was not allowed right after a TLD.
|
@lipoja Hey, Could you look at this. Requesting a review. |
lipoja
approved these changes
Oct 2, 2026
Owner
|
Thank you for your contribution! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I ran into this while using urlextract in a project that pulls issue descriptions out of Jira. Jira stores Google Docs links as smart links in its wiki markup, and this is what one of those looked like:
On 1.9.0
find_urls()gives back a single URL that contains both copies of the link, the two pipes and thesmart-linklabel at the end. I first thought it was something odd about the Google Docs URL, but the same thing happens with anyurl|labeltext.The
|separator is not specific to Jira. Confluence wiki markup uses[https://example.com|label], Slack uses<https://example.com|label>, MediaWiki and DokuWiki use[[https://example.com|label]]. Anyone feeding text from those tools into urlextract will hit this.Cause
|is already in_stop_chars_left, but not in_stop_chars_right, so the right side of the URL runs through the pipe. It is also not in the set of characters allowed right after a TLD, so a bareexample.com|labelis rejected outright.Change
|intogeneral_stop_charsso it stops the URL on both sides.|to the characters allowed after a TLD.Result
The Jira text above now returns two URLs, both ending before the pipe.
[http://example.com|Example]returnshttp://example.com, andsee example.com|otherreturnsexample.com.A URL cannot contain a raw
|; RFC 3986 requires it to be percent-encoded. So I do not expect this to break any valid URL. All 182 tests pass.