mirror of
https://github.com/Drop-OSS/drop.git
synced 2026-07-24 17:03:00 +10:00
fix: object fs backend not deleting metadata
This commit is contained in:
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user