Skip to content

[Validator] Url validator not validating hosts ending in a number #20102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

gwkunze
Copy link
Contributor

@gwkunze gwkunze commented Sep 30, 2016

Q A
Branch? 2.7
Bug fix? yes
New feature? no
BC breaks? no (Should validate slightly more urls)
Deprecations? no
Tests pass? yes
Fixed tickets None that I could find
License MIT
Doc PR

We ran into an issue where the URL validator wasn't validating URL that we got from a legitimate (intranet) URL. Afaict from skimming RFCs the URL http://myhost123/ is valid, however the current regular expression doesn't accept the last part of a hostname (in this case the entire hostname is the last part as there are no periods in the host).

I've fixed this by adding the numbers unicode character property to the regular expression, I'm not sure but symbol characters (\pS) might need to be added to the group as well.

@gwkunze gwkunze changed the title [Validator] Url validator [Validator] Url validator not validating hosts ending in a number Sep 30, 2016
@nicolas-grekas
Copy link
Member

👍

@fabpot
Copy link
Member

fabpot commented Oct 3, 2016

Thank you @gwkunze.

fabpot added a commit that referenced this pull request Oct 3, 2016
… number (gwkunze)

This PR was squashed before being merged into the 2.7 branch (closes #20102).

Discussion
----------

[Validator] Url validator not validating hosts ending in a number

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no (Should validate slightly more urls)
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | None that I could find
| License       | MIT
| Doc PR        |

We ran into an issue where the URL validator wasn't validating URL that we got from a legitimate (intranet) URL. Afaict from skimming RFCs the URL `http://myhost123/` is valid, however the current regular expression doesn't accept the last part of a hostname (in this case the entire hostname is the last part as there are no periods in the host).

I've fixed this by adding the numbers unicode character property to the regular expression, I'm not sure but symbol characters (`\pS`) might need to be added to the group as well.

Commits
-------

934c434 [Validator] Url validator not validating hosts ending in a number
@fabpot fabpot closed this Oct 3, 2016
This was referenced Oct 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants