diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2020-06-12 20:20:10 +0200 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2020-06-12 20:20:10 +0200 |
commit | ebdb2ba9d15e6cdfb1458e7895032afd641aafe3 (patch) | |
tree | 4042808e2a4a3ed7dba11ae0bafa506cf919cd73 /lib/jobs | |
parent | 0b8c5d4180b305d7cfcd94bba34d1a1324fb2a38 (diff) | |
download | libquotient-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.cpp | 4 |
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"); |