aboutsummaryrefslogtreecommitdiff
path: root/jobs
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2018-01-15 10:27:31 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2018-01-15 10:27:31 +0900
commit0de5e3b421633bb58805aa4b9d1bf3f07535702c (patch)
treee0aa05203ae15dca0c8b3efec1495d5e1615e495 /jobs
parent0910bf6c5bbc6c9250023796b2e641f19232c3cd (diff)
downloadlibquotient-0de5e3b421633bb58805aa4b9d1bf3f07535702c.tar.gz
libquotient-0de5e3b421633bb58805aa4b9d1bf3f07535702c.zip
DownloadFileJob: Be tolerant to request retries
Diffstat (limited to 'jobs')
-rw-r--r--jobs/downloadfilejob.cpp5
1 files changed, 3 insertions, 2 deletions
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";