diff options
author | Hannah von Reth <hannah.vonreth@owncloud.com> | 2021-12-08 16:40:59 +0300 |
---|---|---|
committer | Hannah von Reth <vonreth@kde.org> | 2021-12-09 18:15:44 +0300 |
commit | 4b117b68115677955c0e9927e6e18f781cfb198f (patch) | |
tree | db6d87faadd4cd24b9bcb93bf360ea481e828e73 /src/libsync | |
parent | 108fcadce3a87dbf26abdb0126ed21298d2bdd69 (diff) |
Only check for locked files before we start the upload
Fixes: #9194
Diffstat (limited to 'src/libsync')
-rw-r--r-- | src/libsync/propagateuploadng.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/libsync/propagateuploadng.cpp b/src/libsync/propagateuploadng.cpp index e384becb0..0b0dc574e 100644 --- a/src/libsync/propagateuploadng.cpp +++ b/src/libsync/propagateuploadng.cpp @@ -84,6 +84,16 @@ State machine: void PropagateUploadFileNG::doStartUpload() { + const QString fileName = propagator()->fullLocalPath(_item->_file); + // If the file is currently locked, we want to retry the sync + // when it becomes available again. + const auto lockMode = propagator()->syncOptions().requiredLockMode(); + if (FileSystem::isFileLocked(fileName, lockMode)) { + emit propagator()->seenLockedFile(fileName, lockMode); + abortWithError(SyncFileItem::SoftError, tr("%1 the file is currently in use").arg(fileName)); + return; + } + propagator()->_activeJobList.append(this); UploadRangeInfo rangeinfo = { 0, _item->_size }; @@ -375,14 +385,6 @@ void PropagateUploadFileNG::startNextChunk() _currentChunkSize = qMin(propagator()->_chunkSize, _rangesToUpload.first().size); const QString fileName = propagator()->fullLocalPath(_item->_file); - // If the file is currently locked, we want to retry the sync - // when it becomes available again. - const auto lockMode = propagator()->syncOptions().requiredLockMode(); - if (FileSystem::isFileLocked(fileName, lockMode)) { - emit propagator()->seenLockedFile(fileName, lockMode); - abortWithError(SyncFileItem::SoftError, tr("%1 the file is currently in use").arg(fileName)); - return; - } auto device = std::unique_ptr<UploadDevice>(new UploadDevice( fileName, _currentChunkOffset, _currentChunkSize, &propagator()->_bandwidthManager)); if (!device->open(QIODevice::ReadOnly)) { |