mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-03-11 02:15:57 -05:00
fix: internal error for unpublished tarball (#5119)
This commit is contained in:
parent
13e0fdef08
commit
85e0e135aa
5 changed files with 20 additions and 20 deletions
7
.changeset/forty-hounds-matter.md
Normal file
7
.changeset/forty-hounds-matter.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
'verdaccio': patch
|
||||
'@verdaccio/store': patch
|
||||
'@verdaccio/utils': patch
|
||||
---
|
||||
|
||||
fix: internal error for unpublished tarball
|
|
@ -41,19 +41,15 @@ export function getVersion(versions: Versions, version: string): Version | undef
|
|||
* @return {Array} sorted Array
|
||||
*/
|
||||
export function sortVersionsAndFilterInvalid(listVersions: string[] /* logger */): string[] {
|
||||
return (
|
||||
listVersions
|
||||
.filter(function (version): boolean {
|
||||
if (!semver.parse(version, true)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
})
|
||||
// FIXME: it seems the @types/semver do not handle a legitimate method named 'compareLoose'
|
||||
// @ts-ignore
|
||||
.sort(semver.compareLoose)
|
||||
.map(String)
|
||||
);
|
||||
return listVersions
|
||||
.filter(function (version): boolean {
|
||||
if (!semver.parse(version, true)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
})
|
||||
.sort(semver.compareLoose)
|
||||
.map(String);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -366,7 +366,7 @@ class Storage {
|
|||
const [updatedManifest] = await this.syncUplinksMetadata(name, cachedManifest, {
|
||||
uplinksLook: true,
|
||||
});
|
||||
const distFile = (updatedManifest as Manifest)._distfiles[filename];
|
||||
const distFile = (updatedManifest as Manifest)?._distfiles?.[filename];
|
||||
|
||||
if (updatedManifest === null || !distFile) {
|
||||
debug('remote tarball not found');
|
||||
|
|
|
@ -235,8 +235,6 @@ export function normalizeContributors(contributors: Author[]): Author[] {
|
|||
if (_.isNil(contributors)) {
|
||||
return [];
|
||||
} else if (contributors && _.isArray(contributors) === false) {
|
||||
// FIXME: this branch is clearly no an array, still tsc complains
|
||||
// @ts-ignore
|
||||
return [contributors];
|
||||
} else if (_.isString(contributors)) {
|
||||
return [
|
||||
|
|
|
@ -50,10 +50,9 @@ describe('basic test endpoints', () => {
|
|||
(await server.getPackage('unpublish-new-package')).status(HTTP_STATUS.OK);
|
||||
(await server.removePackage('unpublish-new-package', '_rev')).status(HTTP_STATUS.CREATED);
|
||||
(await server.getPackage('unpublish-new-package')).status(HTTP_STATUS.NOT_FOUND);
|
||||
// FIXME: throws 500 instead 404
|
||||
// (await server.getTarball('unpublish-new-package', 'unpublish-new-package-1.0.0.tgz')).status(
|
||||
// HTTP_STATUS.NOT_FOUND
|
||||
// );
|
||||
(await server.getTarball('unpublish-new-package', 'unpublish-new-package-1.0.0.tgz')).status(
|
||||
HTTP_STATUS.NOT_FOUND
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue