Skip to content

Commit de32ee9

Browse files
committed
fix(upload): skip locked files during upload to avoid errors
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
1 parent 651108d commit de32ee9

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/libsync/propagateuploadv1.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ void PropagateUploadFileV1::startNextChunk()
136136
const QString fileName = _fileToUpload._path;
137137
auto device = std::make_unique<UploadDevice>(
138138
fileName, chunkStart, currentChunkSize, &propagator()->_bandwidthManager);
139-
if (auto isLocked = FileSystem::isFileLocked(fileName, FileSystem::LockMode::SharedRead); isLocked || !device->open(QIODevice::ReadOnly)) {
139+
if (const auto isLocked = FileSystem::isFileLocked(fileName, FileSystem::LockMode::SharedRead); isLocked || !device->open(QIODevice::ReadOnly)) {
140140
qCWarning(lcPropagateUploadV1) << "Could not prepare upload device: " << device->errorString();
141141

142142
// If the file is currently locked, we want to retry the sync
@@ -145,7 +145,7 @@ void PropagateUploadFileV1::startNextChunk()
145145
emit propagator()->seenLockedFile(fileName);
146146
}
147147
// Soft error because this is likely caused by the user modifying his files while syncing
148-
abortWithError(SyncFileItem::SoftError, device->errorString());
148+
abortWithError(isLocked ? SyncFileItem::FileLocked : SyncFileItem::SoftError, device->errorString());
149149
return;
150150
}
151151

0 commit comments

Comments
 (0)