Skip to content

Commit 8c3e1f0

Browse files
committed
chore: fix automated test for locked files
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
1 parent 6c05da9 commit 8c3e1f0

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

src/csync/csync_exclude.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ enum CSYNC_EXCLUDE_TYPE {
3737
CSYNC_FILE_EXCLUDE_SERVER_BLACKLISTED,
3838
CSYNC_FILE_EXCLUDE_LEADING_SPACE,
3939
CSYNC_FILE_EXCLUDE_LEADING_AND_TRAILING_SPACE,
40+
CSYNC_FILE_LOCKED_SILENTLY_EXCLUDED,
4041
};
4142

4243
class ExcludedFilesTest;

src/libsync/discovery.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -259,13 +259,6 @@ bool ProcessDirectoryJob::handleExcluded(const QString &path, const Entries &ent
259259

260260
auto excluded = _discoveryData->_excludes->traversalPatternMatch(path, isDirectory ? ItemTypeDirectory : ItemTypeFile);
261261

262-
if (OCC::FileSystem::isFileLocked(_discoveryData->_localDir + path, OCC::FileSystem::LockMode::SharedRead)) {
263-
qCInfo(lcDisco) << _discoveryData->_localDir + path << "is locked" << "exluding it from sync";
264-
excluded = CSYNC_FILE_SILENTLY_EXCLUDED;
265-
266-
emit _discoveryData->seenLockedFile(path);
267-
}
268-
269262
const auto fileName = path.mid(path.lastIndexOf('/') + 1);
270263

271264
const auto isLocal = entries.localEntry.isValid();
@@ -368,6 +361,13 @@ bool ProcessDirectoryJob::handleExcluded(const QString &path, const Entries &ent
368361
return true;
369362
}
370363

364+
if (excluded == CSYNC_NOT_EXCLUDED && OCC::FileSystem::isFileLocked(_discoveryData->_localDir + path, OCC::FileSystem::LockMode::SharedRead)) {
365+
qCInfo(lcDisco) << _discoveryData->_localDir + path << "is locked" << "exluding it from sync";
366+
excluded = CSYNC_FILE_LOCKED_SILENTLY_EXCLUDED;
367+
368+
emit _discoveryData->seenLockedFile(_discoveryData->_localDir + path);
369+
}
370+
371371
auto item = SyncFileItemPtr::create();
372372
item->_file = path;
373373
item->_originalFile = path;

0 commit comments

Comments
 (0)