aboutsummaryrefslogtreecommitdiff
path: root/lib/jobs
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2020-06-12 20:20:10 +0200
committerKitsune Ral <Kitsune-Ral@users.sf.net>2020-06-12 20:20:10 +0200
commitebdb2ba9d15e6cdfb1458e7895032afd641aafe3 (patch)
tree4042808e2a4a3ed7dba11ae0bafa506cf919cd73 /lib/jobs
parent0b8c5d4180b305d7cfcd94bba34d1a1324fb2a38 (diff)
downloadlibquotient-ebdb2ba9d15e6cdfb1458e7895032afd641aafe3.tar.gz
libquotient-ebdb2ba9d15e6cdfb1458e7895032afd641aafe3.zip
BaseJob: fail early if the job needs token and there's none
Diffstat (limited to 'lib/jobs')
-rw-r--r--lib/jobs/basejob.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/jobs/basejob.cpp b/lib/jobs/basejob.cpp
index d7daa170..7774a6e2 100644
--- a/lib/jobs/basejob.cpp
+++ b/lib/jobs/basejob.cpp
@@ -341,7 +341,9 @@ void BaseJob::initiate(ConnectionData* connData, bool inBackground)
d->connection = connData;
doPrepare();
- if ((d->verb == HttpVerb::Post || d->verb == HttpVerb::Put)
+ if (d->needsToken && d->connection->accessToken().isEmpty())
+ setStatus(Unauthorised);
+ else if ((d->verb == HttpVerb::Post || d->verb == HttpVerb::Put)
&& d->requestData.source()
&& !d->requestData.source()->isReadable()) {
setStatus(FileError, "Request data not ready");