diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-03-23 12:15:56 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-03-23 12:15:56 +0900 |
commit | 062840871f0d740d55cec0aadb8c18b95f7cef62 (patch) | |
tree | 7c3a978e77e1abdcd00af6fff77d6d244039ed27 /room.cpp | |
parent | 403dde950b4a7398c856d495ed2d66157b175bf1 (diff) | |
download | libquotient-062840871f0d740d55cec0aadb8c18b95f7cef62.tar.gz libquotient-062840871f0d740d55cec0aadb8c18b95f7cef62.zip |
Room::downloadFile(): make sure to store the initiated file transfer anew
QHash doesn't overwrite an entry if it already exists; this might lead to the target file name from the previous transfer kept in the table of file transfers. The commit fixes that.
Diffstat (limited to 'room.cpp')
-rw-r--r-- | room.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -1125,6 +1125,8 @@ void Room::downloadFile(const QString& eventId, const QUrl& localFilename) auto job = connection()->downloadFile(fileUrl, filePath); if (isJobRunning(job)) { + // If there was a previous transfer (completed or failed), remove it. + d->fileTransfers.remove(eventId); d->fileTransfers.insert(eventId, { job, job->targetFileName() }); connect(job, &BaseJob::downloadProgress, this, [this,eventId] (qint64 received, qint64 total) { |