Fix ?meta listings

Fixes ?meta listings (and other requests) for packages with a root
"directory" entry.

Fixes #210
This commit is contained in:
Michael Jackson
2019-08-01 10:05:05 -07:00
parent e757febc33
commit 88a4213caa
5 changed files with 36 additions and 4 deletions

View File

@ -22,7 +22,7 @@ async function findEntry(stream, filename) {
// so we shorten that to just `/index.js` here. A few packages use a
// prefix other than `package/`. e.g. the firebase package uses the
// `firebase_npm/` prefix. So we just strip the first dir name.
path: header.name.replace(/^[^/]+/, ''),
path: header.name.replace(/^[^/]+\/?/, '/'),
type: header.type
};