diff --git a/package.json b/package.json index fde6432..50e4d24 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ztimson/zim-utils", - "version": "0.3.3", + "version": "0.3.4", "description": "Native, dependency-light ZIM archive reader/searcher and Kiwix catalog downloader for Node.js", "author": "Zak Timson", "license": "MIT", diff --git a/src/manager.js b/src/manager.js index 04fbe0a..39a3ab6 100644 --- a/src/manager.js +++ b/src/manager.js @@ -79,9 +79,10 @@ export class ZimManager { async delete(nameOrFile) { const local = await this.list(); - const match = local.find(l => l.name === nameOrFile || l.file === nameOrFile); + const match = local.find(l => l.name === nameOrFile || l.href === nameOrFile); if (!match) throw new Error(`ZIM not found locally: ${nameOrFile}`); - await fs.promises.rm(path.join(this.#dir, match.file), {force: true}); + const file = match.href + (match.href.endsWith('.zim') ? '' : '.zim'); + await fs.promises.rm(path.join(this.#dir, file), {force: true}); const server = await this.#ensureServer(); await server.reload(); return {file: match.file, status: 'deleted'};