Commit eeae2741 authored by Volker Krause's avatar Volker Krause
Browse files

Properly encode mail attachments received via FairEmail share intents

Thanks to https://codereview.qt-project.org/c/qt/qtbase/+/364893 access
to attachments that way finally works correctly.
parent 39b36262
...@@ -228,8 +228,12 @@ void ApplicationController::importFromIntent(const KAndroidExtras::Intent &inten ...@@ -228,8 +228,12 @@ void ApplicationController::importFromIntent(const KAndroidExtras::Intent &inten
body->setBody(text.toUtf8()); body->setBody(text.toUtf8());
msg.addContent(body); msg.addContent(body);
for (const auto &a : attachments) { for (const auto &a : attachments) {
QUrl attUrl(a);
auto att = new KMime::Content; auto att = new KMime::Content;
att->contentType()->setMimeType(ContentResolver::mimeType(QUrl(a)).toUtf8()); att->contentType()->setMimeType(ContentResolver::mimeType(attUrl).toUtf8());
att->contentTransferEncoding()->setEncoding(KMime::Headers::CEbase64);
att->contentTransferEncoding()->setDecoded(true);
att->contentType()->setName(attUrl.fileName(), "utf-8");
QFile f(a); QFile f(a);
if (!f.open(QFile::ReadOnly)) { if (!f.open(QFile::ReadOnly)) {
qCWarning(Log) << "Failed to open attachement:" << a << f.errorString(); qCWarning(Log) << "Failed to open attachement:" << a << f.errorString();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment