Open GazEdge opened 2 years ago
Also http://192.168.1.87:8080/debug
marked as an invalid URL
Any ipv6 address will invalid like this
http://[::1]:3000/projects/5fd65de50df52c1a6781df40/hooks
I think we can replace it
url: function (url) {
return /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-z]{2,63}\b([-a-zA-Z0-9@:%_\+.~#?&/=]*)/i.test(url);
},
on simular this
const isValid = (str) => {try { new URL(str); return true; } catch(e) { return false }};
url: function (url) {
return isValidt(url);
},
it will work on node & browsers.
So, to fix this I used
validator.register('url', isValidUrl, undefined);
The third argument is undefined for using the default error messages.
v3.22.1
Local server URLs are not seen as valid.
Example here: https://codesandbox.io/s/npm-playground-forked-ne791
Code example here: