more secure isRelativeUrl (#8087)

v1.18.x
Aziz Khoury 5 years ago committed by Barış Soner Uşaklı
parent cac4cba224
commit acca0b956e

@ -487,9 +487,18 @@
});
},
// https://github.com/sindresorhus/is-absolute-url
isAbsoluteUrlRE: /^[a-zA-Z][a-zA-Z\d+\-.]*:/,
isWinPathRE: /^[a-zA-Z]:\\/,
isAbsoluteUrl: function (url) {
if (utils.isWinPathRE.test(url)) {
return false;
}
return utils.isAbsoluteUrlRE.test(url);
},
isRelativeUrl: function (url) {
var firstChar = String(url || '').charAt(0);
return (firstChar === '.' || firstChar === '/');
return !utils.isAbsoluteUrl(url);
},
makeNumbersHumanReadable: function (elements) {

Loading…
Cancel
Save