aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/src/slrmanager.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/src/slrmanager.cpp b/src/src/slrmanager.cpp
index 4e7b898..fe60e56 100644
--- a/src/src/slrmanager.cpp
+++ b/src/src/slrmanager.cpp
@@ -47,6 +47,7 @@ QByteArray httpGet(const QString& url, const int* cancelFlag,
return {};
}
+ QByteArray inMemoryBuf;
qint64 totalBytes = -1;
qint64 received = 0;
@@ -57,6 +58,8 @@ QByteArray httpGet(const QString& url, const int* cancelFlag,
received += chunk.size();
if (outFile.isOpen())
outFile.write(chunk);
+ else
+ inMemoryBuf.append(chunk);
if (progressCb && totalBytes > 0)
progressCb(static_cast<float>(received) / static_cast<float>(totalBytes));
});
@@ -87,11 +90,8 @@ QByteArray httpGet(const QString& url, const int* cancelFlag,
return {};
}
- QByteArray body;
- if (destFile.isEmpty())
- body = reply->readAll(); // small responses fully buffered
reply->deleteLater();
- return body;
+ return inMemoryBuf;
}
} // namespace