Do not close putmultifilejob devices if not open, log when they are not open

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2023-05-11 21:27:06 +08:00
parent 35b05fca85
commit 651615ce94

View file

@ -71,15 +71,22 @@ void PutMultiFileJob::start()
bool PutMultiFileJob::finished() bool PutMultiFileJob::finished()
{ {
for(const auto &oneDevice : _devices) {
oneDevice._device->close();
}
qCInfo(lcPutMultiFileJob) << "POST of" << reply()->request().url().toString() << path() << "FINISHED WITH STATUS" qCInfo(lcPutMultiFileJob) << "POST of" << reply()->request().url().toString() << path() << "FINISHED WITH STATUS"
<< replyStatusString() << replyStatusString()
<< reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute) << reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute)
<< reply()->attribute(QNetworkRequest::HttpReasonPhraseAttribute); << reply()->attribute(QNetworkRequest::HttpReasonPhraseAttribute);
for(const auto &oneDevice : _devices) {
Q_ASSERT(oneDevice._device);
if (oneDevice._device->isOpen()) {
oneDevice._device->close();
} else {
qCWarning(lcPutMultiFileJob) << "Did not close device" << oneDevice._device.get()
<< "as it was not open";
}
}
emit finishedSignal(); emit finishedSignal();
return true; return true;
} }