Merge pull request #3174 from nextcloud/bug/avoidAssertEmptyDateHeader

avoid an assert by delaying access to response timestamp when in error
This commit is contained in:
Matthieu Gallien 2021-04-21 09:22:31 +02:00 committed by GitHub
commit b3daa9b8ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -635,12 +635,10 @@ void PropagateDownloadFile::slotGetFinished()
ASSERT(job);
_item->_httpErrorCode = job->reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
_item->_responseTimeStamp = job->responseTimestamp();
_item->_requestId = job->requestId();
QNetworkReply::NetworkError err = job->reply()->error();
if (err != QNetworkReply::NoError) {
// If we sent a 'Range' header and get 416 back, we want to retry
// without the header.
const bool badRangeHeader = job->resumeStart() > 0 && _item->_httpErrorCode == 416;
@ -711,6 +709,8 @@ void PropagateDownloadFile::slotGetFinished()
return;
}
_item->_responseTimeStamp = job->responseTimestamp();
if (!job->etag().isEmpty()) {
// The etag will be empty if we used a direct download URL.
// (If it was really empty by the server, the GETFileJob will have errored