fix: object fs backend not deleting metadata

This commit is contained in:
Huskydog9988
2025-05-14 16:51:45 -04:00
parent ccdbbcf01c
commit b551788c4c
+4
View File
@@ -99,6 +99,9 @@ export class FsObjectBackend extends ObjectBackend {
const objectPath = path.join(this.baseObjectPath, id); const objectPath = path.join(this.baseObjectPath, id);
if (!fs.existsSync(objectPath)) return true; if (!fs.existsSync(objectPath)) return true;
fs.rmSync(objectPath); fs.rmSync(objectPath);
const metadataPath = path.join(this.baseMetadataPath, `${id}.json`);
if (!fs.existsSync(metadataPath)) return true;
fs.rmSync(metadataPath);
// remove item from cache // remove item from cache
await this.hashStore.delete(id); await this.hashStore.delete(id);
return true; return true;
@@ -153,6 +156,7 @@ export class FsObjectBackend extends ObjectBackend {
await store.save(id, hashResult); await store.save(id, hashResult);
return typeof hashResult; return typeof hashResult;
} }
async listAll(): Promise<string[]> { async listAll(): Promise<string[]> {
return fs.readdirSync(this.baseObjectPath); return fs.readdirSync(this.baseObjectPath);
} }