robots-parser
robots-parser copied to clipboard
Crash when passing an invalid URL
It would be nice to handle invalid URLs better instead of crashing. I had to search quite a while why it was not working as it was not clear that robots-parser did not accept an URL without the protocol.
It seems it could be done by validating the result of this call at line 173 in Robots.js
this._url = libUrl.parse(url);
The same validation would also be needed in Robots.prototype.isAllowed
Let me know if you'd like me to submit a pull request for this.
Hello. This issue still valid for latest version?
I must have missed the notification for this! Sorry about that.
I've added a fix so it now handles URLs with missing protocols, etc. Thanks for repotting!