Skip to content

Commit

Permalink
fix: check author if lastest is not found (#1994)
Browse files Browse the repository at this point in the history
  • Loading branch information
juanpicado committed Nov 22, 2020
1 parent 64f6cbd commit 185babc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/api/web/endpoint/package.ts
Expand Up @@ -125,7 +125,13 @@ function addPackageWebApi(route: Router, storage: IStorageHandler, auth: IAuth,
sideBarInfo.latest.author = formatAuthor(sideBarInfo.latest.author);
} else {
sideBarInfo.latest = sideBarInfo.versions[info[DIST_TAGS].latest];
sideBarInfo.latest.author = formatAuthor(sideBarInfo.latest.author);
if (sideBarInfo?.latest) {
sideBarInfo.latest.author = formatAuthor(sideBarInfo.latest.author);
} else {
res.status(HTTP_STATUS.NOT_FOUND);
res.end();
return;
}
}
sideBarInfo = deleteProperties(['readme', '_attachments', '_rev', 'name'], sideBarInfo);
if (config.web) {
Expand Down

0 comments on commit 185babc

Please sign in to comment.