mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-09-21 07:46:06 +08:00
Fix bug where we wouldn't create an id for file parts.
This commit is contained in:
parent
2d932dd090
commit
aa49f85980
|
@ -2,7 +2,7 @@ const {PromiseUtils, IMAPConnection} = require('isomorphic-core')
|
||||||
|
|
||||||
module.exports = (sequelize, Sequelize) => {
|
module.exports = (sequelize, Sequelize) => {
|
||||||
return sequelize.define('file', {
|
return sequelize.define('file', {
|
||||||
id: { type: Sequelize.STRING(65), primaryKey: true },
|
id: { type: Sequelize.STRING(500), primaryKey: true },
|
||||||
accountId: { type: Sequelize.STRING, allowNull: false },
|
accountId: { type: Sequelize.STRING, allowNull: false },
|
||||||
version: Sequelize.INTEGER,
|
version: Sequelize.INTEGER,
|
||||||
filename: Sequelize.STRING(500),
|
filename: Sequelize.STRING(500),
|
||||||
|
|
|
@ -10,7 +10,6 @@ function collectFilesFromStruct({db, message, struct}) {
|
||||||
// Only exposes partId for inline attachments
|
// Only exposes partId for inline attachments
|
||||||
const partId = part.disposition.type === 'inline' ? part.partID : null;
|
const partId = part.disposition.type === 'inline' ? part.partID : null;
|
||||||
const filename = part.disposition.params ? part.disposition.params.filename : null;
|
const filename = part.disposition.params ? part.disposition.params.filename : null;
|
||||||
|
|
||||||
collected.push(File.build({
|
collected.push(File.build({
|
||||||
filename: filename,
|
filename: filename,
|
||||||
partId: partId,
|
partId: partId,
|
||||||
|
@ -18,6 +17,7 @@ function collectFilesFromStruct({db, message, struct}) {
|
||||||
contentType: `${part.type}/${part.subtype}`,
|
contentType: `${part.type}/${part.subtype}`,
|
||||||
accountId: message.accountId,
|
accountId: message.accountId,
|
||||||
size: part.size,
|
size: part.size,
|
||||||
|
id: `${message.id}-${partId}-${part.size}`,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue