fix: return empty object for /last-modified route if icon sets are missing

This commit is contained in:
Vjacheslav Trushkin 2022-11-07 19:18:17 +02:00
parent c712d9c85f
commit 5b468c8100
2 changed files with 2 additions and 9 deletions

View File

@ -24,7 +24,6 @@ export function generateLastModifiedResponse(query: FastifyRequest['query'], res
const response: APIv3LastModifiedResponse = {
lastModified,
};
let found = false;
for (let i = 0; i < prefixes.length; i++) {
const prefix = prefixes[i];
@ -32,16 +31,10 @@ export function generateLastModifiedResponse(query: FastifyRequest['query'], res
if (item) {
const value = item.item.common.lastModified;
if (value) {
found = true;
lastModified[prefix] = value;
}
}
}
if (!found) {
// No matches
res.send(404);
return;
}
sendJSONResponse(response, q, wrap, res);
}

View File

@ -90,7 +90,7 @@ export interface APIv2CollectionResponse {
chars?: Record<string, string>;
// Themes
themes?: IconifyJSON['themes'];
themes?: IconifyJSON['themes']; // Deprecated, so it can be ignored
prefixes?: IconifyJSON['prefixes'];
suffixes?: IconifyJSON['suffixes'];
}
@ -127,7 +127,7 @@ export interface APIv2SearchResponse {
// Number of results. If same as `limit`, more results are available
total: number;
// Number of results shown
// Maximum number of items allowed by query
limit: number;
// Index of first result