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

UrlParser blows up with partial URL #3

Open
razzed opened this issue Oct 8, 2018 · 0 comments
Open

UrlParser blows up with partial URL #3

razzed opened this issue Oct 8, 2018 · 0 comments

Comments

@razzed
Copy link

razzed commented Oct 8, 2018

The following causes a TypeError when attempting to access u as an Array when it's null:

at Object.urlParser (as parse) in urlparser/index.js — line 129
TypeError: Cannot read property '1' of null

Code to replicate:

var urlparser = require("urlparser");
urlparser.parse("http:")

or

var urlparser = require("urlparser");
urlparser.parse("https:")

Would suggest simply checking for null from RegEx execution and return empty object in this case. I use this to validate URLs as a user is typing them in and so it blows up as they type.

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

No branches or pull requests

1 participant