GoogleChromeLabs / pptraas.com

Puppeteer as a service
https://pptraas.com
Apache License 2.0
457 stars 78 forks source link

Improve URL verification #25

Closed mathiasbynens closed 6 years ago

mathiasbynens commented 6 years ago

The previous URL checks are trivial to bypass (e.g. by changing the casing).

For any kind of URL validation, avoid string comparisons. It’s safer to use new URL(string) and rely on the URL API’s functionality. This guarantees you’re dealing with a normalized URL object.