From 782a2fdf067aef33bbc338b4ecd1110fb2826957 Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Tue, 20 Apr 2021 17:38:36 +0200 Subject: [PATCH] avoid an assert by delaying access to response timestamp when in error when canceling the sync of a big directory, I can get some network request that are aborted before a Date reply header has been read in this case we would always access AbstractNetworkJob::responseTimestamp() and fire the assert even if we know that the network reply has an error delay the access to after the possible errors have been dealt with Signed-off-by: Matthieu Gallien --- src/libsync/propagatedownload.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libsync/propagatedownload.cpp b/src/libsync/propagatedownload.cpp index 824a7e3e8..77cd9856e 100644 --- a/src/libsync/propagatedownload.cpp +++ b/src/libsync/propagatedownload.cpp @@ -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