diff options
Diffstat (limited to 'api/logic/net')
-rw-r--r-- | api/logic/net/FileSink.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/api/logic/net/FileSink.cpp b/api/logic/net/FileSink.cpp index 7dfc4336..f52c5788 100644 --- a/api/logic/net/FileSink.cpp +++ b/api/logic/net/FileSink.cpp @@ -71,8 +71,18 @@ JobStatus FileSink::abort() JobStatus FileSink::finalize(QNetworkReply& reply) { + bool gotFile = false; + QVariant statusCodeV = reply.attribute(QNetworkRequest::HttpStatusCodeAttribute); + bool validStatus = false; + int statusCode = statusCodeV.toInt(&validStatus); + if(validStatus) + { + // this leaves out 304 Not Modified + gotFile = statusCode == 200 || statusCode == 203; + } // if we wrote any data to the save file, we try to commit the data to the real file. - if (wroteAnyData) + // if it actually got a proper file, we write it even if it was empty + if (gotFile || wroteAnyData) { // ask validators for data consistency // we only do this for actual downloads, not 'your data is still the same' cache hits |