Skip to content

Commit 356d120

Browse files
committed
fix: remove variant for minio client
1 parent 37e8c6b commit 356d120

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/attachment_manager.ts

+10-2
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,16 @@ export class AttachmentManager<KnownConverters extends Record<string, Converter>
191191

192192
if (attachment instanceof Attachment) {
193193
if (attachment.variants) {
194-
const variantPath = attachment.variants[0].folder
195-
await attachment.getDisk().deleteAll(variantPath)
194+
if (attachment.options?.disk == 'fs') {
195+
const variantPath = attachment.variants[0].folder
196+
await attachment.getDisk().deleteAll(variantPath)
197+
} else {
198+
for (const key in attachment.variants) {
199+
if (Object.prototype.hasOwnProperty.call(attachment.variants, key)) {
200+
await attachment.getDisk().delete(attachment.variants[key].path)
201+
}
202+
}
203+
}
196204
}
197205
}
198206
}

0 commit comments

Comments
 (0)