From a68e12235430901f71982ad2593268f38ea4b85b Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Fri, 11 Jul 2008 20:45:17 +0000 Subject: Recover from broken emails without a final boundary (Zarafa). --- src/body.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/body.cpp b/src/body.cpp index a6b74a76..b9180d74 100644 --- a/src/body.cpp +++ b/src/body.cpp @@ -186,8 +186,29 @@ void body::parse(const string& buffer, const string::size_type position, m_contents = vmime::create (); - if (partStart < end) + // Last part was not found: recover from missing boundary + if (!lastPart && pos == string::npos) + { + ref part = vmime::create (); + + try + { + part->parse(buffer, partStart, end); + } + catch (std::exception&) + { + throw; + } + + part->m_parent = m_part; + + m_parts.push_back(part); + } + // Treat remaining text as epilog + else if (partStart < end) + { m_epilogText = string(buffer.begin() + partStart, buffer.begin() + end); + } } // Treat the contents as 'simple' data else -- cgit