From b31762ea43bcfd65403be1ad5b133cf1899d030b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Sun, 27 Nov 2022 15:46:15 +0100 Subject: [PATCH] fix quoteted attach filename --- src/cpp/Attachment.cpp | 2 +- src/cpp/MainAttachment.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/cpp/Attachment.cpp b/src/cpp/Attachment.cpp index cb497fc..dbb0905 100644 --- a/src/cpp/Attachment.cpp +++ b/src/cpp/Attachment.cpp @@ -65,7 +65,7 @@ const string Attachment::KAZ_ATTACH_NAME (".---KazAttachment---.html"); const regex Attachment::nameCharsetRegEx (".*name\\*=(.*)"); -const regex Attachment::nameRegEx (".*name=\"([^\"]*)\".*"); +const regex Attachment::nameRegEx (".*name=\\s*\"?(.*)\"?\\s*;?\\s*"); // boundary="----=_Part_796779_1154936629.1668080348646" // boundary="------------040709000505010508040808" // boundary="----------=_1668606031-941125-91" diff --git a/src/cpp/MainAttachment.cpp b/src/cpp/MainAttachment.cpp index b469d29..d52b809 100644 --- a/src/cpp/MainAttachment.cpp +++ b/src/cpp/MainAttachment.cpp @@ -257,7 +257,7 @@ MainAttachment::getDisclaim (string &plain, string &html) const { return; } - plain = "\r\n"+KAZ_PLAIN_START+"\r\n"+KAZ_PLAIN_HR+"\r\n"+KAZ_PLAIN_DONT_TOUCH+"\r\n\r\n"+KAZ_PLAIN_WARNING+"\r\n\r\n"+KAZ_PLAIN_DOWLOAD_ONE+"\r\n"+plainNewLinks; + plain = "\r\n"+KAZ_PLAIN_START+"\r\n"+KAZ_PLAIN_HR+"\r\n"+KAZ_PLAIN_DONT_TOUCH+"\r\n\r\n"+KAZ_PLAIN_DOWLOAD_ONE+"\r\n"+plainNewLinks; html = templateHtmlHeader+htmlNewLinks; if (previousLinks.size ()) { plain += "\r\n"+KAZ_PLAIN_DOWLOAD_OTHER+"\r\n"+plainOldLinks; @@ -272,7 +272,7 @@ MainAttachment::getDisclaim (string &plain, string &html) const { html += allHtmlLinks; } html += templateHtmlFooter+"\r\n"; - plain += "\r\n\r\n"+KAZ_WEB_SITE+"\r\n"+KAZ_PLAIN_HR+"\r\n"+KAZ_PLAIN_STOP+"\r\n"; + plain += "\r\n\r\n"+KAZ_WEB_SITE+"\r\n\r\n"+KAZ_PLAIN_WARNING+"\r\n"+KAZ_PLAIN_HR+"\r\n"+KAZ_PLAIN_STOP+"\r\n"; // & => & done LOG ("plain: " << plain); LOG ("html: " << html); @@ -685,6 +685,7 @@ MainAttachment::substitute (ifstream &mbox, ofstream &outbox, const SizeArg &min curPos = attachP->endPos; } if (plainDisclaim.size () && (attachMode & ATTACHMENT)) { + // XXX si pas de multipart LOG ("Add kaz attachment"); LOG_BUG (boundary.empty () || ! subAttachements.size (), /**/, "eMailShrinker: can't add Kaz attachment M10: : " << *this); streamoff lastPos = subAttachements.back ().endPos;