diff --git a/src/components/chat/ChatModel.cpp b/src/components/chat/ChatModel.cpp index 80be1b39e..97d229dad 100644 --- a/src/components/chat/ChatModel.cpp +++ b/src/components/chat/ChatModel.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include "../../app/App.hpp" #include "../../app/paths/Paths.hpp" @@ -392,8 +393,15 @@ void ChatModel::sendFileMessage (const QString &path) { } shared_ptr content = CoreManager::getInstance()->getCore()->createContent(); - content->setType("application"); - content->setSubtype("octet-stream"); + { + QStringList mimeType = QMimeDatabase().mimeTypeForFile(path).name().split('/'); + if (mimeType.length() != 2) { + qWarning() << QStringLiteral("Unable to get supported mime type for: `%1`.").arg(path); + return; + } + content->setType(::Utils::appStringToCoreString(mimeType[0])); + content->setSubtype(::Utils::appStringToCoreString(mimeType[1])); + } content->setSize(static_cast(fileSize)); content->setName(::Utils::appStringToCoreString(QFileInfo(file).fileName()));