Fix to blob deletion w/ disk store (#2381)
pds: ensure account deletion doesn't touch others' blobs
This commit is contained in:
parent
97482da17a
commit
9b78f06134
packages
@ -76,7 +76,10 @@ export class SeedClient<
|
||||
{ text: string; ref: RecordRef; images: ImageRef[]; quote?: RecordRef }[]
|
||||
>
|
||||
likes: Record<string, Record<string, AtUri>>
|
||||
replies: Record<string, { text: string; ref: RecordRef }[]>
|
||||
replies: Record<
|
||||
string,
|
||||
{ text: string; ref: RecordRef; images: ImageRef[] }[]
|
||||
>
|
||||
reposts: Record<string, RecordRef[]>
|
||||
lists: Record<
|
||||
string,
|
||||
@ -378,6 +381,7 @@ export class SeedClient<
|
||||
const reply = {
|
||||
text,
|
||||
ref: new RecordRef(res.uri, res.cid),
|
||||
images: images ?? [],
|
||||
}
|
||||
this.replies[by].push(reply)
|
||||
return reply
|
||||
|
@ -141,7 +141,9 @@ export class DiskBlobStore implements BlobStore {
|
||||
}
|
||||
|
||||
async deleteAll(): Promise<void> {
|
||||
await rmIfExists(this.location, true)
|
||||
await rmIfExists(path.join(this.location, this.did), true)
|
||||
await rmIfExists(path.join(this.tmpLocation, this.did), true)
|
||||
await rmIfExists(path.join(this.quarantineLocation, this.did), true)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -185,6 +185,13 @@ describe('account deletion', () => {
|
||||
await expect(attempt2).rejects.toThrow(BlobNotFoundError)
|
||||
})
|
||||
|
||||
it('maintains blobs from other actors', async () => {
|
||||
const bobBlobstore = network.pds.ctx.blobstore(sc.dids.bob)
|
||||
const [img] = sc.replies[sc.dids.bob][0].images
|
||||
const attempt = bobBlobstore.getBytes(img.image.ref)
|
||||
await expect(attempt).resolves.toBeDefined()
|
||||
})
|
||||
|
||||
it('can delete an empty user', async () => {
|
||||
const eve = await sc.createAccount('eve', {
|
||||
handle: 'eve.test',
|
||||
|
Loading…
x
Reference in New Issue
Block a user