From ebdb2ba9d15e6cdfb1458e7895032afd641aafe3 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Fri, 12 Jun 2020 20:20:10 +0200 Subject: BaseJob: fail early if the job needs token and there's none --- lib/jobs/basejob.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/jobs') 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"); -- cgit v1.2.3