Skip to content

Commit a413718

Browse files
committed
fix: add early return for empty s3Paths in deleteAttachmentRecords function
1 parent 90597c9 commit a413718

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,9 @@ export default class RichEditorPlugin extends AdminForthPlugin {
122122
const deleteAttachmentRecords = async (
123123
adminforth: IAdminForth, options: PluginOptions, s3Paths: string[], adminUser: AdminUser
124124
) => {
125-
125+
if (!s3Paths.length) {
126+
return;
127+
}
126128
const attachmentPrimaryKeyField = this.attachmentResource.columns.find(c => c.primaryKey);
127129

128130
const attachments = await adminforth.resource(options.attachments.attachmentResource).list(

0 commit comments

Comments
 (0)