From bef90acddc35fa4fb1b231b64be85809366cfc3f Mon Sep 17 00:00:00 2001 From: Leo Lamprecht Date: Sat, 19 May 2018 22:15:06 +0200 Subject: [PATCH] Remove duplicated slashes --- lib/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index d7a8b7f..f4c98bb 100644 --- a/lib/index.js +++ b/lib/index.js @@ -86,7 +86,6 @@ const shouldRedirect = (rewrittenPath, {redirects = [], trailingSlash = null}) = } const defaultType = 301; - console.log(rewrittenPath); if (typeof trailingSlash === 'boolean') { const {ext} = path.parse(rewrittenPath); @@ -100,6 +99,10 @@ const shouldRedirect = (rewrittenPath, {redirects = [], trailingSlash = null}) = target = `${rewrittenPath}/`; } + if (rewrittenPath.indexOf('//') > -1) { + target = rewrittenPath.replace(/\/+/g, '/'); + } + if (target) { return { target,