diff options
| author | Silarn <jrim@rimpo.org> | 2018-06-25 20:50:49 -0500 |
|---|---|---|
| committer | Silarn <jrim@rimpo.org> | 2018-06-25 20:50:49 -0500 |
| commit | 181de232f43941b5ffefbccca78a6076e1e854a9 (patch) | |
| tree | 3b93d7d8b73412d127a200924b07e8f1f15d41a5 /src/downloadmanager.cpp | |
| parent | 1f9103c24e1a9bc929507bd67814df3973c9e1db (diff) | |
Potential fix for corrupted downloads
Diffstat (limited to 'src/downloadmanager.cpp')
| -rw-r--r-- | src/downloadmanager.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp index ecbcc03b..6d8658c9 100644 --- a/src/downloadmanager.cpp +++ b/src/downloadmanager.cpp @@ -1251,6 +1251,7 @@ void DownloadManager::downloadProgress(qint64 bytesReceived, qint64 bytesTotal) try {
DownloadInfo *info = findDownload(this->sender(), &index);
if (info != nullptr) {
+ info->m_HasData = true;
if (info->m_State == STATE_CANCELING) {
setState(info, STATE_CANCELED);
} else if (info->m_State == STATE_PAUSING) {
@@ -1637,7 +1638,7 @@ void DownloadManager::downloadFinished(int index) if (info != nullptr) {
QNetworkReply *reply = info->m_Reply;
QByteArray data;
- if (reply->isOpen()) {
+ if (reply->isOpen() && info->m_HasData) {
data = reply->readAll();
info->m_Output.write(data);
}
@@ -1666,7 +1667,7 @@ void DownloadManager::downloadFinished(int index) if (info->m_State == STATE_CANCELING) {
setState(info, STATE_CANCELED);
} else if (info->m_State == STATE_PAUSING) {
- if (info->m_Output.isOpen()) {
+ if (info->m_Output.isOpen() && info->m_HasData) {
info->m_Output.write(info->m_Reply->readAll());
}
setState(info, STATE_PAUSED);
|
