aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--room.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/room.cpp b/room.cpp
index 0e4b1385..51da747e 100644
--- a/room.cpp
+++ b/room.cpp
@@ -1005,6 +1005,14 @@ void Room::downloadFile(const QString& eventId, const QUrl& localFilename)
(safeTempPrefix + fileInfo->originalName) :
!event->plainBody().isEmpty() ? (safeTempPrefix + event->plainBody()) :
(safeTempPrefix + fileInfo->mimeType.preferredSuffix());
+ if (QSysInfo::productType() == "windows")
+ {
+ const auto& suffixes = fileInfo->mimeType.suffixes();
+ if (!suffixes.isEmpty() &&
+ std::none_of(suffixes.begin(), suffixes.end(),
+ [fileName] (const QString& s) { return fileName.endsWith(s); }))
+ fileName += '.' + fileInfo->mimeType.preferredSuffix();
+ }
auto job = connection()->downloadFile(fileInfo->url, fileName);
if (isJobRunning(job))
{