mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 20:19:22 +03:00
Bugfix handling attachments MIME type / content-type as it was broken.
This commit is contained in:
parent
ee5fb1a83e
commit
f4448635d1
12 changed files with 461 additions and 302 deletions
|
|
@ -55,10 +55,17 @@ import { MimeToMessage } from 'Mime/Utils';
|
|||
|
||||
import { MessageModel } from 'Model/Message';
|
||||
|
||||
import { showScreenPopup } from 'Knoin/Knoin';
|
||||
import { OpenPgpImportPopupView } from 'View/Popup/OpenPgpImport';
|
||||
import { GnuPGUserStore } from 'Stores/User/GnuPG';
|
||||
import { OpenPGPUserStore } from 'Stores/User/OpenPGP';
|
||||
|
||||
const
|
||||
oMessageScrollerDom = () => elementById('messageItem') || {},
|
||||
|
||||
currentMessage = MessageUserStore.message;
|
||||
currentMessage = MessageUserStore.message,
|
||||
|
||||
fetchRaw = url => rl.fetch(url).then(response => response.ok && response.text());
|
||||
|
||||
export class MailMessageView extends AbstractViewRight {
|
||||
constructor() {
|
||||
|
|
@ -284,22 +291,23 @@ export class MailMessageView extends AbstractViewRight {
|
|||
|
||||
el = eqs(event, '.attachmentsPlace .attachmentName');
|
||||
if (el) {
|
||||
const attachment = ko.dataFor(el);
|
||||
if (attachment?.linkDownload()) {
|
||||
if ('message/rfc822' == attachment.mimeType) {
|
||||
const attachment = ko.dataFor(el), url = attachment?.linkDownload();
|
||||
if (url) {
|
||||
if ('application/pgp-keys' == attachment.mimeType
|
||||
&& (OpenPGPUserStore.isSupported() || GnuPGUserStore.isSupported())) {
|
||||
fetchRaw(url).then(text =>
|
||||
showScreenPopup(OpenPgpImportPopupView, [text])
|
||||
);
|
||||
} else if ('message/rfc822' == attachment.mimeType) {
|
||||
// TODO
|
||||
rl.fetch(attachment.linkDownload()).then(response => {
|
||||
if (response.ok) {
|
||||
response.text().then(text => {
|
||||
const oMessage = new MessageModel();
|
||||
MimeToMessage(text, oMessage);
|
||||
// cleanHTML
|
||||
oMessage.viewPopupMessage();
|
||||
});
|
||||
}
|
||||
fetchRaw(url).then(text => {
|
||||
const oMessage = new MessageModel();
|
||||
MimeToMessage(text, oMessage);
|
||||
// cleanHTML
|
||||
oMessage.viewPopupMessage();
|
||||
});
|
||||
} else {
|
||||
download(attachment.linkDownload(), attachment.fileName);
|
||||
download(url, attachment.fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue