-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Description
Hello!
poco c++ has code in Net/src/MailMessage.cpp file:
std::string getFileNameFromDisp(const std::string& str)
{
StringTokenizer st(str, ";=", StringTokenizer::TOK_IGNORE_EMPTY | StringTokenizer::TOK_TRIM);
StringTokenizer::Iterator it = st.begin();
StringTokenizer::Iterator end = st.end();
for (; it != end; ++it) { if (*it == "filename") break; }
if (it != end)
{
++it;
if (it == end) return "";
return *it;
}
return "";
}
poco gets file name from Content-Type. So, I suposeed it should get it from "name" instead of "filename" property.
Example,
Content-Type: application/pdf; name="example.pdf" <-- see "name" is used instead of "filename".
So when poco parses attachment Poco::Net::StringPartSource::filename() returns empty string.
According RFC filename Content-Disposition should keep file name of attachment. (If I am not wrong).
Example,
Content-Disposition: attachment; filename="example.pdf"
But in fact file name usually exists in both Content-Disposition and Content-Type in different value names, "filename" and "name".
Reactions are currently unavailable