https://bugs.kde.org/show_bug.cgi?id=523826
Bug ID: 523826
Summary: KMime re-serialization adds blank line between content
parts (content.cpp:311-315)
Classification: Frameworks and Libraries
Product: frameworks-kmime
Version First 6.28.0
Reported In:
Platform: Neon
OS: Linux
Status: REPORTED
Severity: minor
Priority: NOR
Component: general
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
DESCRIPTION
KMime's re-serialization adds a newline, so the original isn't preserved. So
KMime is adding a newline after the closing delimiter even when the original
wire format didn't have one. This increases byte count by 1.
content:
Content-Type: multipart/mixed; boundary="OUTER"\n\n--OUTER\nContent-Type:
multipart/alternative; boundary="INNER"\n\n--INNER\nContent-Type:
text/plain\n\nhi\n--INNER--\n--OUTER\nContent-Type:
text/plain\n\nbye\n--OUTER--\n
in 207 bytes, out 208 bytes
before parse:
Content-Type: text/plain
hi
--INNER--
--OUTER
Content-Type: text/plain
bye
--OUTER--
after parse:
Content-Type: text/plain
hi
--INNER--
--OUTER
Content-Type: text/plain
bye
--OUTER--
In KMime's Content::encodedContent() assembly (content.cpp:311-315):
for (Content *c : ...) {
e += boundary + '\n'; // boundary = "\n--OUTER" — always prepends \n
e += c->encodedContent(...);
}
e += boundary + "--\n"; // closing delimiter always gets its own \n
The closing delimiter is unconditionally terminated with \n, and the parent
unconditionally prepends \n to the next boundary — so --INNER-- directly
followed by --OUTER on the wire always comes back as --INNER-- + blank line +
--OUTER.
STEPS TO REPRODUCE
1. Parse content in KMime
2. Compare unparsed vs parsed content
OBSERVED RESULT
\n added
EXPECTED RESULT
no change of content
SOFTWARE/OS VERSIONS
Operating System: KDE neon User Edition
KDE Plasma Version: 6.7.3
KDE Frameworks Version: 6.28.0
Qt Version: 6.11.1
--
You are receiving this mail because:
You are watching all bug changes.