Skip to content
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

matching URL with .* less correct than with .+ #854

Closed
hallvors opened this issue Dec 11, 2015 · 2 comments
Closed

matching URL with .* less correct than with .+ #854

hallvors opened this issue Dec 11, 2015 · 2 comments

Comments

@hallvors
Copy link
Contributor

In this regular expression:
https://github.com/webcompat/webcompat.com/blob/master/webcompat/helpers.py#L368
when we do (.*) we do not actually intend to look for "0 or more characters" - a 0 characters long URL isn't a URL. We should use + instead of *.

@miketaylr
Copy link
Member

Is a 1 character long URL a valid URL? If not, I'm not sure it makes much of a difference, but a good first patch indeed. 😜

@hallvors
Copy link
Contributor Author

Well, there's code elsewhere to handle URLs without a http(s):// prefix I think - certainly at Opera "t" was a URL and a pretty important one ;)
We can always do {3,} or something like that to require three or more characters but who knows what will be a minimum valid URL length down the road? I'm however pretty sure that a 0 character long string is going to remain invalid. It's good with some certainties in life :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants