FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Use ASCII digits in port number parsing by zopieux · Pull Request #207 · mozilla/bleach · GitHub

This repository was archived by the owner on Jun 10, 2026. It is now read-only.
/ bleach Public archive

Use ASCII digits in port number parsing - #207

Closed
zopieux wants to merge 1 commit into
mozilla:masterfrom
zopieux:master
Closed

zopieux wants to merge 1 commit into
mozilla:masterfrom
zopieux:master

Conversation

zopieux commented Jun 18, 2016 •
edited
Loading

Copy link
Copy Markdown
Contributor

Currently, bleach accepts (linkyfies) the following “URLs”:

  • http://foo.com:𝟠𝟘𝟠𝟘/
  • http://foo.com:٣٩٩٩/

That is because the \d modifier of Python unicode regular expressions matches all digits in the Nd block (search for category [Nd] here), and there are many things in there.

This PR replaces \d with [0-9]+ and two test URLs to assert these links are not recognized.

Note: an alternative would be to use the re.ASCII flag but:

  • it's hard to be compatible with Python 2
  • it may not be appropriate because we do want to match funky unicode chars in other parts of the URL

Note: funnily enough, GitHub-flavored markdown also linkyfies them! http://foo.com:𝟠𝟘𝟠𝟘/

willkg added this to the v1.5 milestone Sep 26, 2016

willkg commented Sep 26, 2016

Copy link
Copy Markdown
Member

Tossing this in the v1.5 milestone. I'll look through it next week.

willkg commented Oct 31, 2016

Copy link
Copy Markdown
Member

I broke this when I switched to py.test. I fixed the commit in PR #225. Closing this out in favor of that one.

willkg closed this Oct 31, 2016
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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL