From b5360de125a8a1477176dc3a47472494fa036d5c Mon Sep 17 00:00:00 2001 From: Curt Tudor Date: Thu, 9 Jan 2025 10:15:24 -0700 Subject: [PATCH] fix: Drop of very large files into Mattermost causes exception (#189) --- src/channel/channel.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/channel/channel.js b/src/channel/channel.js index 62e72b1..24ae9d0 100644 --- a/src/channel/channel.js +++ b/src/channel/channel.js @@ -722,7 +722,11 @@ class ZitiChannel { // this._zitiContext.logger.debug(`send (no wait) -> ch[${this._id}] conn[${(options.conn ? options.conn.id : 'n/a')}] seq[${messageId}] contentType[${contentType}] bodyLen[${(body ? body.length : 'n/a')}] body[${(body ? body.toString() : 'n/a')}]`); this._zitiContext.logger.debug(`ch.sendMessageNoWait() -> ch[${this._id}] conn[${(options.conn ? options.conn.id : 'n/a')}] socket[${options.conn ? options.conn.socket._id : 'n/a'}][${options.conn ? options.conn.socket.isNew : 'n/a'}] seq[${messageId}] contentType[${contentType}] byteLength[${(body ? body.byteLength : 'n/a')}]`); - this._zitiContext.logger.debug(`ch.sendMessageNoWait() -> body[${(body ? body.toString() : 'n/a')}]`); + try { + this._zitiContext.logger.debug(`ch.sendMessageNoWait() -> body[${(body ? body.toString() : 'n/a')}]`); + } catch (e) { + this._zitiContext.logger.debug(`ch.sendMessageNoWait() -> body.byteLength[${(body ? body.byteLength : 'n/a')}]`); + } this._sendMarshaled(contentType, headers, body, options, messageId); }