diff --git a/api/src/chat/repositories/block.repository.ts b/api/src/chat/repositories/block.repository.ts index c796e75..4ddb9aa 100644 --- a/api/src/chat/repositories/block.repository.ts +++ b/api/src/chat/repositories/block.repository.ts @@ -53,6 +53,7 @@ export class BlockRepository extends BaseRepository< if ( block.message && 'attachment' in block.message && + block.message.attachment.payload && 'url' in block.message.attachment.payload ) { this.logger.error( diff --git a/api/src/chat/services/block.service.ts b/api/src/chat/services/block.service.ts index f7353b7..f3fb45f 100644 --- a/api/src/chat/services/block.service.ts +++ b/api/src/chat/services/block.service.ts @@ -409,6 +409,7 @@ export class BlockService extends BaseService { if ( block.message && 'attachment' in block.message && + block.message.attachment.payload && 'url' in block.message.attachment.payload ) { this.logger.error( diff --git a/api/src/chat/validation-rules/is-message.ts b/api/src/chat/validation-rules/is-message.ts index 0b11cc8..fbd1589 100644 --- a/api/src/chat/validation-rules/is-message.ts +++ b/api/src/chat/validation-rules/is-message.ts @@ -71,7 +71,7 @@ export function isValidMessage(msg: any) { .required(), payload: Joi.object().keys({ url: Joi.string().uri(), - attachment_id: Joi.string(), + attachment_id: Joi.string().allow(null), }), }), elements: Joi.boolean(),