From dfca8a3a30be73d5b88fa95e8c362fbfa11bcbc3 Mon Sep 17 00:00:00 2001 From: thecodrr Date: Fri, 31 Dec 2021 10:58:38 +0500 Subject: [PATCH] fix: do not throw if attachment is invalid --- packages/core/collections/attachments.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/packages/core/collections/attachments.js b/packages/core/collections/attachments.js index c41bddf00..bbeeca016 100644 --- a/packages/core/collections/attachments.js +++ b/packages/core/collections/attachments.js @@ -1,13 +1,7 @@ import Collection from "./collection"; import id from "../utils/id"; import { deleteItem, hasItem } from "../utils/array"; -import hosts from "../utils/constants"; -import { - checkIsUserPremium, - EV, - EVENTS, - sendAttachmentsProgressEvent, -} from "../common"; +import { EV, EVENTS, sendAttachmentsProgressEvent } from "../common"; import dataurl from "../utils/dataurl"; import dayjs from "dayjs"; import setManipulator from "../utils/set"; @@ -91,8 +85,12 @@ export default class Attachments extends Collection { !chunkSize || !key ) { - console.error("Attachment invalid:", attachment); - throw new Error("Could not add attachment: all properties are required."); + console.error( + "Attachment is invalid because all properties are required:", + attachment + ); + // throw new Error("Could not add attachment: all properties are required."); + return; } const encryptedKey = await this._encryptKey(key);