From ec6953df30fde3a97350c32e41aabdc7265e6167 Mon Sep 17 00:00:00 2001 From: mertmit Date: Thu, 29 Feb 2024 10:39:39 +0000 Subject: [PATCH] fix: issue with attachment upload --- packages/nocodb/src/services/attachments.service.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/nocodb/src/services/attachments.service.ts b/packages/nocodb/src/services/attachments.service.ts index 71f1c18532..8f4d7fd58e 100644 --- a/packages/nocodb/src/services/attachments.service.ts +++ b/packages/nocodb/src/services/attachments.service.ts @@ -12,6 +12,7 @@ import Local from '~/plugins/storage/Local'; import mimetypes, { mimeIcons } from '~/utils/mimeTypes'; import { PresignedUrl } from '~/models'; import { utf8ify } from '~/helpers/stringHelpers'; +import { NcError } from '~/helpers/catchError'; @Injectable() export class AttachmentsService { @@ -34,6 +35,10 @@ export class AttachmentsService { const attachments = []; const errors = []; + if (!param.files?.length) { + NcError.badRequest('No attachment provided!'); + } + queue.addAll( param.files?.map((file) => async () => { try { @@ -127,6 +132,10 @@ export class AttachmentsService { const attachments = []; const errors = []; + if (!param.urls?.length) { + NcError.badRequest('No attachment provided!'); + } + queue.addAll( param.urls?.map?.((urlMeta) => async () => { try {