From 2592c5eca63994aab3cd2eca76029d19284b5924 Mon Sep 17 00:00:00 2001 From: Vamshi Palreddy Date: Mon, 29 Oct 2018 03:25:52 +0530 Subject: [PATCH] Ignore multiple slashes in file path. --- modules/middleware/findFile.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/middleware/findFile.js b/modules/middleware/findFile.js index e1cc53f..ba2c564 100644 --- a/modules/middleware/findFile.js +++ b/modules/middleware/findFile.js @@ -118,6 +118,7 @@ function searchEntries(tarballStream, entryName, wantsIndex) { const leadingSlash = /^\//; const trailingSlash = /\/$/; +const multipleSlash = /\/\/+/; /** * Fetch and search the archive to try and find the requested file. @@ -126,6 +127,7 @@ const trailingSlash = /\/$/; function findFile(req, res, next) { fetchNpmPackage(req.packageConfig).then(tarballStream => { const entryName = req.filename + .replace(multipleSlash, "/") .replace(trailingSlash, "") .replace(leadingSlash, ""); const wantsIndex = trailingSlash.test(req.filename);