mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-02-23 06:18:03 +08:00
cidWithOutTags => cidWithoutTags and don't check foundedCIDs because isLinked is already set
This commit is contained in:
parent
6d5317d969
commit
46198861bc
2 changed files with 7 additions and 7 deletions
|
@ -186,7 +186,7 @@ class AttachmentModel extends AbstractModel {
|
||||||
this.isLinked = false;
|
this.isLinked = false;
|
||||||
this.isThumbnail = false;
|
this.isThumbnail = false;
|
||||||
this.cid = '';
|
this.cid = '';
|
||||||
this.cidWithOutTags = '';
|
this.cidWithoutTags = '';
|
||||||
this.contentLocation = '';
|
this.contentLocation = '';
|
||||||
this.download = '';
|
this.download = '';
|
||||||
this.folder = '';
|
this.folder = '';
|
||||||
|
@ -215,7 +215,10 @@ class AttachmentModel extends AbstractModel {
|
||||||
this.mimeType = ((json.MimeType || '').toLowerCase()).trim();
|
this.mimeType = ((json.MimeType || '').toLowerCase()).trim();
|
||||||
this.fileName = json.FileName.trim();
|
this.fileName = json.FileName.trim();
|
||||||
this.estimatedSize = pInt(json.EstimatedSize);
|
this.estimatedSize = pInt(json.EstimatedSize);
|
||||||
|
// if it is inline
|
||||||
this.isInline = !!json.IsInline;
|
this.isInline = !!json.IsInline;
|
||||||
|
// if inline image is linked with CID in html
|
||||||
|
// and 'src="cid:' or background-image:url(cid:)
|
||||||
this.isLinked = !!json.IsLinked;
|
this.isLinked = !!json.IsLinked;
|
||||||
this.isThumbnail = !!json.IsThumbnail;
|
this.isThumbnail = !!json.IsThumbnail;
|
||||||
this.cid = json.CID;
|
this.cid = json.CID;
|
||||||
|
@ -228,7 +231,7 @@ class AttachmentModel extends AbstractModel {
|
||||||
this.framed = !!json.Framed;
|
this.framed = !!json.Framed;
|
||||||
|
|
||||||
this.friendlySize = friendlySize(this.estimatedSize);
|
this.friendlySize = friendlySize(this.estimatedSize);
|
||||||
this.cidWithOutTags = this.cid.replace(/^<+/, '').replace(/>+$/, '');
|
this.cidWithoutTags = this.cid.replace(/^<+/, '').replace(/>+$/, '');
|
||||||
|
|
||||||
this.fileNameExt = getFileExtension(this.fileName);
|
this.fileNameExt = getFileExtension(this.fileName);
|
||||||
this.fileType = staticFileType(this.fileNameExt, this.mimeType);
|
this.fileType = staticFileType(this.fileNameExt, this.mimeType);
|
||||||
|
|
|
@ -9,15 +9,12 @@ export class AttachmentCollectionModel extends AbstractCollectionModel
|
||||||
* @param {?Array} json
|
* @param {?Array} json
|
||||||
* @returns {AttachmentCollectionModel}
|
* @returns {AttachmentCollectionModel}
|
||||||
*/
|
*/
|
||||||
static reviveFromJson(items, foundedCIDs) {
|
static reviveFromJson(items) {
|
||||||
let result = new AttachmentCollectionModel;
|
let result = new AttachmentCollectionModel;
|
||||||
items = this.getFromJSON(items, 'AttachmentCollection') || items;
|
items = this.getFromJSON(items, 'AttachmentCollection') || items;
|
||||||
Array.isArray(items) && items.forEach(attachment => {
|
Array.isArray(items) && items.forEach(attachment => {
|
||||||
attachment = AttachmentModel.newInstanceFromJson(attachment);
|
attachment = AttachmentModel.newInstanceFromJson(attachment);
|
||||||
if (attachment) {
|
if (attachment) {
|
||||||
if (attachment.cidWithOutTags && foundedCIDs.includes(attachment.cidWithOutTags)) {
|
|
||||||
attachment.isLinked = true;
|
|
||||||
}
|
|
||||||
result.push(attachment);
|
result.push(attachment);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -37,6 +34,6 @@ export class AttachmentCollectionModel extends AbstractCollectionModel
|
||||||
*/
|
*/
|
||||||
findByCid(cid) {
|
findByCid(cid) {
|
||||||
cid = cid.replace(/^<+|>+$/, '');
|
cid = cid.replace(/^<+|>+$/, '');
|
||||||
return this.find(item => cid === item.cidWithOutTags);
|
return this.find(item => cid === item.cidWithoutTags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue