aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--room.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/room.cpp b/room.cpp
index d1b098e7..bec4cd30 100644
--- a/room.cpp
+++ b/room.cpp
@@ -837,11 +837,14 @@ void Room::downloadFile(const QString& eventId, const QUrl& localFilename)
return;
}
auto* fileInfo = event->content()->fileInfo();
+ auto safeTempPrefix = eventId;
+ safeTempPrefix.replace(':', '_');
+ safeTempPrefix = QDir::tempPath() + '/' + safeTempPrefix + '#';
auto fileName = !localFilename.isEmpty() ? localFilename.toLocalFile() :
!fileInfo->originalName.isEmpty() ?
- (QDir::tempPath() + '/' + fileInfo->originalName) :
+ (safeTempPrefix + fileInfo->originalName) :
!event->plainBody().isEmpty() ?
- (QDir::tempPath() + '/' + event->plainBody()) : QString();
+ (safeTempPrefix + event->plainBody()) : QString();
auto job = connection()->downloadFile(fileInfo->url, fileName);
if (isJobRunning(job))
{