Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changelog/unreleased/91947
-rw-r--r--src/libsync/propagateuploadng.cpp18
2 files changed, 17 insertions, 8 deletions
diff --git a/changelog/unreleased/9194 b/changelog/unreleased/9194
new file mode 100644
index 000000000..5482b2e4a
--- /dev/null
+++ b/changelog/unreleased/9194
@@ -0,0 +1,7 @@
+Bugfix: Don't abort upload if chunk is locked
+
+Since 2.9 we know that we need exclusive file access to a file to properly handle it with Windows virtual files.
+Therefore we checked for the locked state before we start the upload.
+Due to a bug we checked that for each file chunk, now we only check when the upload starts and when it finished completely.
+
+https://github.com/owncloud/client/issues/9194
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)) {