Merge pull request #1 from vamshi29292/multiple-slash-bug

Ignore multiple slashes in file path.
This commit is contained in:
Vamshi Palreddy 2018-10-29 03:34:27 +05:30 committed by GitHub
commit c130e652b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -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);