diff --git "a/src/api/routes/channels/\043channel_id/attachments.ts" "b/src/api/routes/channels/\043channel_id/attachments.ts" index 0e0185d..76e88bc 100644 --- "a/src/api/routes/channels/\043channel_id/attachments.ts" +++ "b/src/api/routes/channels/\043channel_id/attachments.ts" @@ -73,7 +73,6 @@ // validate IDs const seenIds: (string | undefined)[] = []; for (const file of payload.files) { - file.id ??= "0"; if (seenIds.includes(file.id)) { return res.status(400).json({ code: 400, @@ -86,12 +85,12 @@ const attachments = await Promise.all( payload.files.map(async (attachment) => { attachment.filename = attachment.filename.replaceAll(" ", "_").replace(/[^a-zA-Z0-9._]+/g, ""); - const uploadFilename = `${channel_id}/${batchId}/${attachment.id}/${attachment.filename}`; + const uploadFilename = `${channel_id}/${batchId}/${attachment.id ?? "0"}/${attachment.filename}`; const newAttachment = CloudAttachment.create({ user: user, channel: channel, uploadFilename: uploadFilename, - userAttachmentId: attachment.id, + userAttachmentId: attachment.id ?? "0", userFilename: attachment.filename, userFileSize: attachment.file_size, userIsClip: attachment.is_clip,