mirror of
https://github.com/nodemailer/wildduck.git
synced 2025-03-05 04:13:08 +08:00
do not store metadata with attachment entry in gridstore
This commit is contained in:
parent
e3746090f4
commit
8c7cedc977
2 changed files with 4 additions and 8 deletions
3
api.js
3
api.js
|
@ -1079,7 +1079,7 @@ server.get('/message/:message/attachment/:attachment', (req, res, next) => {
|
|||
}
|
||||
|
||||
res.writeHead(200, {
|
||||
'Content-Type': messageData.metadata.contentType
|
||||
'Content-Type': messageData.contentType || 'application/octet-stream'
|
||||
});
|
||||
|
||||
let attachmentStream = messageHandler.indexer.gridstore.createReadStream(messageData._id);
|
||||
|
@ -1093,7 +1093,6 @@ server.get('/message/:message/attachment/:attachment', (req, res, next) => {
|
|||
} else {
|
||||
attachmentStream.pipe(res);
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -371,16 +371,13 @@ class Indexer {
|
|||
let store = this.gridstore.createWriteStream(attachmentId, {
|
||||
fsync: true,
|
||||
content_type: contentType,
|
||||
// metadata should include only minimally required information, this would allow
|
||||
// to share attachments between different messages if the content is exactly the same
|
||||
// even though metadata (filename, content-disposition etc) might not
|
||||
metadata: {
|
||||
// if we copy the same message to other mailboxes then instead
|
||||
// of copying attachments we add a pointer to the new message here
|
||||
messages: [messageId],
|
||||
// decoded filename to display in a web client or API
|
||||
fileName,
|
||||
// content-type for the attachment
|
||||
contentType,
|
||||
// is it really an attachment? maybe it's a very long text part?
|
||||
disposition,
|
||||
// how to decode contents if a webclient or API asks for the attachment
|
||||
transferEncoding
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue