diff --git a/src/lib/services/catalog-audit.ts b/src/lib/services/catalog-audit.ts index 08bf8280..158cf20f 100644 --- a/src/lib/services/catalog-audit.ts +++ b/src/lib/services/catalog-audit.ts @@ -183,8 +183,8 @@ export async function runCatalogAudit( } })(), ]); - const iconSet = new Set(iconFiles); - const nitroSet = new Set(nitroFiles); + let iconSet = new Set(iconFiles); + let nitroSet = new Set(nitroFiles); // Badge detection: `items_base.type = 'b'` is authoritative. The album1584 // `.gif` listing is kept as a fallback for hotels that store badges with a // non-standard type. @@ -466,6 +466,15 @@ export async function runCatalogAudit( } }); + // Re-read directories so the set reflects files written + // by the repair pass. + const [repairedIconFiles, repairedNitroFiles] = await Promise.all([ + readdir(iconDir).catch(() => [] as string[]), + readdir(nitroDir).catch(() => [] as string[]), + ]); + iconSet = new Set(repairedIconFiles); + nitroSet = new Set(repairedNitroFiles); + // Re-check which of the previously-missing icons are still missing // and drop the ones the repair fixed from the issue list. The ones // left over cannot be restored from any source → legacy/broken. @@ -530,6 +539,15 @@ export async function runCatalogAudit( } }); + // Re-read directories so the set reflects files written + // by the repair pass. + const [repairedIconFiles2, repairedNitroFiles2] = await Promise.all([ + readdir(iconDir).catch(() => [] as string[]), + readdir(nitroDir).catch(() => [] as string[]), + ]); + iconSet = new Set(repairedIconFiles2); + nitroSet = new Set(repairedNitroFiles2); + // Re-check which of the previously-missing nitros are still missing // and drop the ones the repair fixed from the issue list. The ones // left over cannot be restored from any source → legacy/broken.