From d51cb50e4be817df00776f8d82b5cc5997dbd791 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Wed, 11 Aug 2021 15:35:05 +0200 Subject: [PATCH] Fix Safari compatibility (#148) Co-authored-by: Sindre Sorhus --- index.js | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index f8297f5..4727186 100644 --- a/index.js +++ b/index.js @@ -120,8 +120,38 @@ export default function normalizeUrl(urlString, options) { } // Remove duplicate slashes if not preceded by a protocol + // NOTE: This could be implemented using a single negative lookbehind + // regex, but we avoid that to maintain compatibility with older js engines + // which do not have support for that feature. if (urlObject.pathname) { - urlObject.pathname = urlObject.pathname.replace(/(?