Better pathing
All checks were successful
Publish Library / Build NPM Project (push) Successful in 9s
Publish Library / Tag Version (push) Successful in 9s

This commit is contained in:
2026-08-22 10:22:32 -04:00
parent f5eaf7f764
commit c38f149733
2 changed files with 4 additions and 2 deletions

View File

@@ -73,8 +73,10 @@ export class ZimManager {
/** Resolves a file path or catalog `name` to a local file path. */
async #resolveFile(fileOrName) {
if (fs.existsSync(fileOrName)) return fileOrName;
const joined = path.join(this.#dir, fileOrName);
if (fs.existsSync(joined)) return joined;
const local = await this.list();
const match = local.find(l => l.meta?.name === fileOrName);
const match = local.find(l => l.meta?.name === fileOrName || path.basename(l.file) === fileOrName);
if (!match) throw new Error(`ZIM not found locally: ${fileOrName}`);
return match.file;
}