From 1540688c184b1612a66b1174568f8fe7fbce22af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Thu, 8 Dec 2022 16:42:20 +0100 Subject: [PATCH] fix double mime, windows \r --- src/bash/filter.sh | 2 ++ src/cpp/MainAttachment.cpp | 7 ++++--- src/cpp/kazMisc.cpp | 5 +++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/bash/filter.sh b/src/bash/filter.sh index 6233085..80d2dc7 100644 --- a/src/bash/filter.sh +++ b/src/bash/filter.sh @@ -146,6 +146,8 @@ if ! cat > "${INSPECT_DIR}/in.$$"; then LOG_FIC "${RED}Cannot save mail to file${NC}" quitFilter "${EX_TEMPFAIL}" fi +dos2unix "${INSPECT_DIR}/in.$$" + LOG_FIC "${NL}" \ " size: ${YELLOW}$(wc -c < "${INSPECT_DIR}/in.$$")${NC}" [ -n "${DEBUG}" ] && (mkdir -p "${DIR_LOG}/pb/" ; cp "${INSPECT_DIR}/in.$$" "${DIR_LOG}/pb/in.$$.orig") diff --git a/src/cpp/MainAttachment.cpp b/src/cpp/MainAttachment.cpp index 1e9680e..38823ea 100644 --- a/src/cpp/MainAttachment.cpp +++ b/src/cpp/MainAttachment.cpp @@ -65,7 +65,7 @@ static const regex archiveURLSignature (".*(([&?]g=)|([&?]l=/)).*"); static const string KAZ_PLAIN_HR ("______________________________________________________________________________"); static const string KAZ_PLAIN_START ("~~ PJ-KAZ !"); // don't end whith space -static const string KAZ_PLAIN_STOP (KAZ_PLAIN_START+" ~~"); +static const string KAZ_PLAIN_STOP (KAZ_PLAIN_START+" ~~\n\n"); static const string KAZ_PLAIN_DONT_TOUCH ("(conservez cette partie intacte dans votre réponse si vous voulez transmettre les documents précédents)"); static const string KAZ_PLAIN_WARNING ("Attention : Kaz a dépollué ce message. Les pièces jointes ont été retirées et placées dans un dépôt provisoire. " "Elles seront automatiquement supprimées dans 1 mois. " @@ -124,7 +124,7 @@ const string MainAttachment::templateHtmlOtherLink (""+KAZ_HTML_DOWLOAD_OTH const string MainAttachment::templateHtmlAllLink ("

\n" "

"+KAZ_WEB_SITE+"

\n" - "

"+KAZ_PLAIN_STOP+"

"+KAZ_HTML_STOP+"\n"); + "

"+KAZ_PLAIN_STOP+"

"+KAZ_HTML_STOP+"\n\n"); const regex MainAttachment::whiteSpaceRegEx ("\\s+"); @@ -639,7 +639,8 @@ MainAttachment::substitute (ifstream &mbox, ofstream &outbox, const SizeArg &min LOG_BUG (isPlain && isHtml, /**/, "eMailShrinker: bug M6: plain and html: " << attachP->getContentType ()); LOG_BUG (! (isPlain || isHtml), /**/, "eMailShrinker: bug M7: not plain or html: " << attachP->getContentType ()); LOG ("toUpdate: isPlain: " << isPlain << " isHtml: " << isHtml << " isDisclaimer: " << isDisclaimer); - copy (mbox, outbox, attachP->beginInParent, attachP->contentPos); + if (attachP != this) + copy (mbox, outbox, attachP->beginInParent, attachP->contentPos); string content = attachP->getContent (mbox); if (isHtml) { diff --git a/src/cpp/kazMisc.cpp b/src/cpp/kazMisc.cpp index 250bd5c..a15598f 100644 --- a/src/cpp/kazMisc.cpp +++ b/src/cpp/kazMisc.cpp @@ -437,9 +437,10 @@ kaz::charsetValue (string &content) { // ================================================================================ void kaz::removeQuote (string &content) { - if (content.empty () || content [0] !='"') + if (content.empty () || content [0] != '"') return; - string::size_type stop = content.rfind ('"'); + + string::size_type stop = content.find ('"', 1); content = stop ? content.substr (1, stop-1) : content.substr (1);