mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-26 15:06:08 +03:00
Propagator: Handle file open error properly and log error message.
This commit is contained in:
parent
1230e87330
commit
2d234cd96f
1 changed files with 19 additions and 8 deletions
|
@ -200,7 +200,7 @@ void PropagateUploadFileQNAM::startNextChunk()
|
|||
}
|
||||
|
||||
QString path = _item._file;
|
||||
QIODevice *device;
|
||||
QIODevice *device = 0;
|
||||
if (_chunkCount > 1) {
|
||||
int sendingChunk = (_currentChunk + _startChunk) % _chunkCount;
|
||||
// XOR with chunk size to make sure everything goes well if chunk size change between runs
|
||||
|
@ -218,14 +218,25 @@ void PropagateUploadFileQNAM::startNextChunk()
|
|||
} else {
|
||||
device = _file;
|
||||
}
|
||||
if (!device->isOpen())
|
||||
device->open(QIODevice::ReadOnly);
|
||||
|
||||
_job = new PUTFileJob(AccountManager::instance()->account(), _propagator->_remoteFolder + path, device, headers);
|
||||
_job->setTimeout(_propagator->httpTimeout() * 1000);
|
||||
connect(_job, SIGNAL(finishedSignal()), this, SLOT(slotPutFinished()));
|
||||
connect(_job, SIGNAL(uploadProgress(qint64,qint64)), this, SLOT(slotUploadProgress(qint64,qint64)));
|
||||
_job->start();
|
||||
bool isOpen = true;
|
||||
if (!device->isOpen()) {
|
||||
isOpen = device->open(QIODevice::ReadOnly);
|
||||
}
|
||||
|
||||
if( isOpen ) {
|
||||
_job = new PUTFileJob(AccountManager::instance()->account(), _propagator->_remoteFolder + path, device, headers);
|
||||
_job->setTimeout(_propagator->httpTimeout() * 1000);
|
||||
connect(_job, SIGNAL(finishedSignal()), this, SLOT(slotPutFinished()));
|
||||
connect(_job, SIGNAL(uploadProgress(qint64,qint64)), this, SLOT(slotUploadProgress(qint64,qint64)));
|
||||
_job->start();
|
||||
} else {
|
||||
delete device;
|
||||
|
||||
qDebug() << "ERR: Could not open upload file: " << device->errorString();
|
||||
done( SyncFileItem::NormalError, device->errorString() );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void PropagateUploadFileQNAM::slotPutFinished()
|
||||
|
|
Loading…
Reference in a new issue