mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-09-07 13:14:47 +08:00
[local-sync]: Fix label/folder id creation
We were using the stripped version of label/folder names for the id hash, e.g. [Gmail]/Drafts would be Drafts. However, we can't do this because it might collide with other names. e.g. if the user created a Drafts label, it would end up colliding with [Gmail]/Drafts Minor lint fix
This commit is contained in:
parent
edbf869ff7
commit
8307976df8
4 changed files with 4 additions and 5 deletions
|
@ -1,6 +1,7 @@
|
|||
const _ = require('underscore');
|
||||
const os = require('os');
|
||||
const fs = require('fs');
|
||||
const path = require('path')
|
||||
const mkdirp = require('mkdirp');
|
||||
|
||||
const {PromiseUtils, IMAPConnection} = require('isomorphic-core');
|
||||
|
|
|
@ -28,8 +28,7 @@ module.exports = (sequelize, Sequelize) => {
|
|||
},
|
||||
|
||||
hash({boxName, accountId}) {
|
||||
const cleanName = formatImapPath(boxName)
|
||||
return crypto.createHash('sha256').update(`${accountId}${cleanName}`, 'utf8').digest('hex')
|
||||
return crypto.createHash('sha256').update(`${accountId}${boxName}`, 'utf8').digest('hex')
|
||||
},
|
||||
},
|
||||
instanceMethods: {
|
||||
|
|
|
@ -43,8 +43,7 @@ module.exports = (sequelize, Sequelize) => {
|
|||
},
|
||||
|
||||
hash({boxName, accountId}) {
|
||||
const cleanName = formatImapPath(boxName)
|
||||
return crypto.createHash('sha256').update(`${accountId}${cleanName}`, 'utf8').digest('hex')
|
||||
return crypto.createHash('sha256').update(`${accountId}${boxName}`, 'utf8').digest('hex')
|
||||
},
|
||||
},
|
||||
instanceMethods: {
|
||||
|
|
|
@ -28,10 +28,10 @@ async function extractContacts({db, message}) {
|
|||
const id = cryptography.createHash('sha256').update(c.email, 'utf8').digest('hex');
|
||||
const existing = await db.Contact.findById(id);
|
||||
const cdata = {
|
||||
id,
|
||||
name: c.name,
|
||||
email: c.email,
|
||||
accountId: message.accountId,
|
||||
id: id,
|
||||
};
|
||||
|
||||
if (!existing) {
|
||||
|
|
Loading…
Add table
Reference in a new issue