Fix bug where we wouldn't create an id for file parts.

This commit is contained in:
Karim Hamidou 2016-12-01 15:29:47 -08:00
parent 2d932dd090
commit aa49f85980
2 changed files with 2 additions and 2 deletions

View file

@ -2,7 +2,7 @@ const {PromiseUtils, IMAPConnection} = require('isomorphic-core')
module.exports = (sequelize, Sequelize) => {
return sequelize.define('file', {
id: { type: Sequelize.STRING(65), primaryKey: true },
id: { type: Sequelize.STRING(500), primaryKey: true },
accountId: { type: Sequelize.STRING, allowNull: false },
version: Sequelize.INTEGER,
filename: Sequelize.STRING(500),

View file

@ -10,7 +10,6 @@ function collectFilesFromStruct({db, message, struct}) {
// Only exposes partId for inline attachments
const partId = part.disposition.type === 'inline' ? part.partID : null;
const filename = part.disposition.params ? part.disposition.params.filename : null;
collected.push(File.build({
filename: filename,
partId: partId,
@ -18,6 +17,7 @@ function collectFilesFromStruct({db, message, struct}) {
contentType: `${part.type}/${part.subtype}`,
accountId: message.accountId,
size: part.size,
id: `${message.id}-${partId}-${part.size}`,
}));
}
}