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

Use the much fancier url-regex #9

Closed
wants to merge 2 commits into from
Closed

Use the much fancier url-regex #9

wants to merge 2 commits into from

Conversation

zeke
Copy link
Contributor

@zeke zeke commented Nov 22, 2014

Scraps the existing regex in favor of https://github.com/kevva/url-regex, per @sindresorhus's suggestion. Because the new regex is more permissive, schemeless strings like google.com are considered to be URLS. This is a breaking change, so I'm thinking of shipping this as 2.0.0.

@sindresorhus
Copy link
Contributor

👍

// @kevva

@kevva
Copy link

kevva commented Nov 22, 2014

+1

Yeah, google.com is valid because it's looking on a list of valid TLDs. google.asdasd wouldn't work. Also, local IPs like 0.0.0.0 and 127.0.0.1 is considered invalid.

@@ -57,10 +56,6 @@ describe('is-url', function () {
assert(url('https://d1f4470da51b49289906b3d6cbd65074@app.getsentry.com/13176'));
});

it('http://0.0.0.0', function () {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this one not work anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does not work any more.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, local IPs like 0.0.0.0 and 127.0.0.1 is considered invalid.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm -1 on this change in that case, purely because we use this in places that users enter a "URL", like to associate with their project, or their development environment (eg. imagine when signing up for an analytics tool and creating a project).

I can see how you might disagree, but in that case feel free to just use the url-regex module directly. This one is doing what we want it to do just fine for us right now.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, I might add a strict option to url-regex to allow for local IPs etc when setting it to false.

@zeke
Copy link
Contributor Author

zeke commented Nov 24, 2014

Compromise: continue using url-regexp, with special allowance for localhosty URLs.

@ianstormtaylor
Copy link
Contributor

I think it makes the whole thing too complicated at that point :/ sorry! I prefer the simple code path without the need for another dependency in this case.

@zeke
Copy link
Contributor Author

zeke commented Nov 25, 2014

Okay. I tried.

@zeke zeke closed this Nov 25, 2014
@ianstormtaylor
Copy link
Contributor

Haha, thanks for trying man, I really do appreciate it. I just think in this case it's best left as-is.

@sindresorhus
Copy link
Contributor

@ianstormtaylor Can you at least reopen and merge #7 then?

@ianstormtaylor
Copy link
Contributor

Sure.

@zeke
Copy link
Contributor Author

zeke commented Nov 25, 2014

Glad to see everyone getting what they want here. :)

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

Successfully merging this pull request may close these issues.

4 participants