Merge branch 'master' of https://github.com/vamshi29292/unpkg.com into vamshi29292-master
This commit is contained in:
commit
ea7f3ab3f3
|
@ -118,6 +118,7 @@ function searchEntries(tarballStream, entryName, wantsIndex) {
|
||||||
|
|
||||||
const leadingSlash = /^\//;
|
const leadingSlash = /^\//;
|
||||||
const trailingSlash = /\/$/;
|
const trailingSlash = /\/$/;
|
||||||
|
const multipleSlash = /\/\/+/;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch and search the archive to try and find the requested file.
|
* Fetch and search the archive to try and find the requested file.
|
||||||
|
@ -126,6 +127,7 @@ const trailingSlash = /\/$/;
|
||||||
function findFile(req, res, next) {
|
function findFile(req, res, next) {
|
||||||
fetchNpmPackage(req.packageConfig).then(tarballStream => {
|
fetchNpmPackage(req.packageConfig).then(tarballStream => {
|
||||||
const entryName = req.filename
|
const entryName = req.filename
|
||||||
|
.replace(multipleSlash, '/')
|
||||||
.replace(trailingSlash, '')
|
.replace(trailingSlash, '')
|
||||||
.replace(leadingSlash, '');
|
.replace(leadingSlash, '');
|
||||||
const wantsIndex = trailingSlash.test(req.filename);
|
const wantsIndex = trailingSlash.test(req.filename);
|
||||||
|
|
Loading…
Reference in New Issue