From 0de5e3b421633bb58805aa4b9d1bf3f07535702c Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Mon, 15 Jan 2018 10:27:31 +0900 Subject: DownloadFileJob: Be tolerant to request retries --- jobs/downloadfilejob.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'jobs') diff --git a/jobs/downloadfilejob.cpp b/jobs/downloadfilejob.cpp index 2530e259..06fa3b48 100644 --- a/jobs/downloadfilejob.cpp +++ b/jobs/downloadfilejob.cpp @@ -36,14 +36,15 @@ QString DownloadFileJob::targetFileName() const void DownloadFileJob::beforeStart(const ConnectionData*) { - if (d->targetFile && !d->targetFile->open(QIODevice::WriteOnly)) + if (d->targetFile && !d->targetFile->isReadable() && + !d->targetFile->open(QIODevice::WriteOnly)) { qCWarning(JOBS) << "Couldn't open the file" << d->targetFile->fileName() << "for writing"; setStatus(FileError, "Could not open the target file for writing"); return; } - if (!d->tempFile->open(QIODevice::WriteOnly)) + if (!d->tempFile->isReadable() && !d->tempFile->open(QIODevice::WriteOnly)) { qCWarning(JOBS) << "Couldn't open the temporary file" << d->tempFile->fileName() << "for writing"; -- cgit v1.2.3