remove trailing slashes and fix test failures

This commit is contained in:
123Haynes 2026-04-01 07:08:30 +00:00
parent 1abe5932ad
commit f01d935bb1
7 changed files with 61 additions and 8 deletions

View file

@ -97,12 +97,13 @@ export async function fetchNewPackagesList() {
const ecosystem = getEcoSystem();
const baseUrl = getMalwareListBaseUrl();
const path = newPackagesListPaths[/** @type {keyof typeof newPackagesListPaths} */ (ecosystem)];
const url = `${baseUrl}/${path}`;
if (!url) {
if (!path) {
return { newPackagesList: [], version: undefined };
}
const url = `${baseUrl}/${path}`;
const response = await fetch(url);
if (!response.ok) {
throw new Error(
@ -130,12 +131,13 @@ export async function fetchNewPackagesListVersion() {
const ecosystem = getEcoSystem();
const baseUrl = getMalwareListBaseUrl();
const path = newPackagesListPaths[/** @type {keyof typeof newPackagesListPaths} */ (ecosystem)];
const url = `${baseUrl}/${path}`;
if (!url) {
if (!path) {
return undefined;
}
const url = `${baseUrl}/${path}`;
const response = await fetch(url, { method: "HEAD" });
if (!response.ok) {
throw new Error(