Skip to content

Commit

Permalink
fix(attachments): Added contentDisposition property for attachments
Browse files Browse the repository at this point in the history
  • Loading branch information
andris9 committed Oct 12, 2023
1 parent fed3d93 commit 292bbc2
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 72 deletions.
8 changes: 8 additions & 0 deletions docs/api/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3452,6 +3452,14 @@ components:
contentType:
type: string
description: MIME type for the attachment file
contentDisposition:
type: string
description: Which Content-Disposition value to use
enum:
- inline
- attachment
example: attachment
default: null
cid:
type: string
description: Content-ID value if you want to reference to this attachment from HTML formatted message
Expand Down
9 changes: 6 additions & 3 deletions lib/api/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -1598,11 +1598,14 @@ module.exports = (db, server, messageHandler, userHandler, storageHandler, setti
attachments: Joi.array().items(
Joi.object().keys({
filename: Joi.string().empty('').max(255),

contentType: Joi.string().empty('').max(255),
encoding: Joi.string().empty('').default('base64'),
contentTransferEncoding: Joi.string().empty(''),
content: Joi.string().required(),
cid: Joi.string().empty('').max(255)
contentDisposition: Joi.string().empty('').trim().lowercase().valid('inline', 'attachment'),
cid: Joi.string().empty('').max(255),

encoding: Joi.string().empty('').default('base64'),
content: Joi.string().required()
})
),

Expand Down
9 changes: 6 additions & 3 deletions lib/api/submit.js
Original file line number Diff line number Diff line change
Expand Up @@ -714,11 +714,14 @@ module.exports = (db, server, messageHandler, userHandler, settingsHandler) => {
attachments: Joi.array().items(
Joi.object().keys({
filename: Joi.string().empty('').max(255),

contentType: Joi.string().empty('').max(255),
contentTransferEncoding: Joi.string().empty('').trim().lowercase(),
contentDisposition: Joi.string().empty('').trim().lowercase().valid('inline', 'attachment'),
cid: Joi.string().empty('').max(255),

encoding: Joi.string().empty('').default('base64'),
contentTransferEncoding: Joi.string().empty(''),
content: Joi.string().required(),
cid: Joi.string().empty('').max(255)
content: Joi.string().required()
})
),
meta: Joi.object().unknown(true),
Expand Down
136 changes: 73 additions & 63 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"base32.js": "0.1.0",
"bcryptjs": "2.4.3",
"bson": "6.1.0",
"bullmq": "4.12.2",
"bullmq": "4.12.3",
"fido2-lib": "3.4.1",
"gelf": "2.0.1",
"generate-password": "1.7.0",
Expand Down Expand Up @@ -97,13 +97,13 @@
"seq-index": "1.1.0",
"smtp-server": "3.13.0",
"speakeasy": "2.0.0",
"undici": "5.25.4",
"undici": "5.26.3",
"unix-crypt-td-js": "1.1.4",
"unixcrypt": "1.2.0",
"uuid": "9.0.1",
"wild-config": "1.7.1",
"yargs": "17.7.2",
"zone-mta": "3.6.11"
"zone-mta": "3.6.13"
},
"repository": {
"type": "git",
Expand Down

0 comments on commit 292bbc2

Please sign in to comment.