Merge pull request #1 from vamshi29292/multiple-slash-bug
Ignore multiple slashes in file path.
This commit is contained in:
commit
c130e652b7
modules/middleware
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue