From 2c014caa725c04f20a5dde77f0e02d535042602d Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Fri, 12 May 2023 23:21:55 +0200 Subject: [PATCH 1/2] Resolve #1126 --- dev/View/Popup/Compose.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/dev/View/Popup/Compose.js b/dev/View/Popup/Compose.js index 482942dcd..17b5436b4 100644 --- a/dev/View/Popup/Compose.js +++ b/dev/View/Popup/Compose.js @@ -1356,7 +1356,7 @@ export class ComposePopupView extends AbstractViewPopup { async getMessageRequestParams(sSaveFolder, draft) { let Text = this.oEditor.getData().trim(), - l = Text.length, + l, hasAttachments = 0; // Prepare ComposeAttachmentModel attachments @@ -1374,10 +1374,6 @@ export class ComposePopupView extends AbstractViewPopup { } }); - if (!draft && !l && !hasAttachments) { - throw i18n('COMPOSE/ERROR_EMPTY_BODY'); - } - const identity = this.currentIdentity(), params = { @@ -1426,6 +1422,9 @@ export class ComposePopupView extends AbstractViewPopup { ? await this.mailvelope.createDraft() : await this.mailvelope.encrypt(recipients); } else if (sign || encrypt) { + if (!draft && !hasAttachments && !Text.length) { + throw i18n('COMPOSE/ERROR_EMPTY_BODY'); + } let data = new MimePart; data.headers['Content-Type'] = 'text/'+(isHtml?'html':'plain')+'; charset="utf-8"'; data.headers['Content-Transfer-Encoding'] = 'base64'; From 59aa1cac359347724b6b277f1ac9306ede1372eb Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Fri, 12 May 2023 23:43:13 +0200 Subject: [PATCH 2/2] Resolve #1125 --- dev/Common/Html.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dev/Common/Html.js b/dev/Common/Html.js index ae68956ba..d27de8d50 100644 --- a/dev/Common/Html.js +++ b/dev/Common/Html.js @@ -289,6 +289,9 @@ export const + (0 < bqLevel ? ',' + (new Array(1 + bqLevel).fill('blockquote').join(' ')) : '') ).forEach(oElement => oElement.remove()); + // https://github.com/the-djmaze/snappymail/issues/1125 + tmpl.content.querySelectorAll('form,button').forEach(oElement => replaceWithChildren(oElement)); + [...tmpl.content.querySelectorAll('*')].forEach(oElement => { const name = oElement.tagName, oStyle = oElement.style; @@ -394,7 +397,7 @@ export const } // if (['CENTER','FORM'].includes(name)) { - if ('FORM' === name || 'O:P' === name || (nonEmptyTags.includes(name) && ('' == oElement.textContent.trim()))) { + if ('O:P' === name || (nonEmptyTags.includes(name) && ('' == oElement.textContent.trim()))) { ('A' !== name || !oElement.querySelector('IMG')) && replaceWithChildren(oElement); return; }