diff --git a/src/common/filesystembase.cpp b/src/common/filesystembase.cpp index 3fc067944..ffc7bca4f 100644 --- a/src/common/filesystembase.cpp +++ b/src/common/filesystembase.cpp @@ -480,6 +480,11 @@ bool FileSystem::isLnkFile(const QString &filename) return filename.endsWith(QLatin1String(".lnk")); } +bool FileSystem::isExcludeFile(const QString &filename) +{ + return filename.endsWith(QLatin1String(".sync-exclude.lst")); +} + bool FileSystem::isJunction(const QString &filename) { #ifdef Q_OS_WIN diff --git a/src/common/filesystembase.h b/src/common/filesystembase.h index 0259fb6c7..b15cb4fa1 100644 --- a/src/common/filesystembase.h +++ b/src/common/filesystembase.h @@ -153,6 +153,11 @@ namespace FileSystem { */ bool OCSYNC_EXPORT isLnkFile(const QString &filename); + /** + * Returns whether the file is an exclude file (contains patterns to exclude from sync) + */ + bool OCSYNC_EXPORT isExcludeFile(const QString &filename); + /** * Returns whether the file is a junction (windows only) */ diff --git a/src/libsync/discovery.cpp b/src/libsync/discovery.cpp index 5b0873bdd..530f67a51 100644 --- a/src/libsync/discovery.cpp +++ b/src/libsync/discovery.cpp @@ -521,7 +521,8 @@ void ProcessDirectoryJob::processFileAnalyzeRemoteInfo( if (!localEntry.isValid() && item->_type == ItemTypeFile && opts._vfs->mode() != Vfs::Off - && _pinState != PinState::AlwaysLocal) { + && _pinState != PinState::AlwaysLocal + && !FileSystem::isExcludeFile(item->_file)) { item->_type = ItemTypeVirtualFile; if (isVfsWithSuffix()) addVirtualFileSuffix(tmp_path._original); diff --git a/src/libsync/vfs/cfapi/vfs_cfapi.cpp b/src/libsync/vfs/cfapi/vfs_cfapi.cpp index 9a8e81353..5db9c5d03 100644 --- a/src/libsync/vfs/cfapi/vfs_cfapi.cpp +++ b/src/libsync/vfs/cfapi/vfs_cfapi.cpp @@ -187,6 +187,8 @@ bool VfsCfApi::statTypeVirtualFile(csync_file_stat_t *stat, void *statData) const auto isWindowsShortcut = !isDirectory && FileSystem::isLnkFile(stat->path); + const auto isExcludeFile = !isDirectory && FileSystem::isExcludeFile(stat->path); + // It's a dir with a reparse point due to the placeholder info (hence the cloud tag) // if we don't remove the reparse point flag the discovery will end up thinking // it is a file... let's prevent it @@ -198,7 +200,7 @@ bool VfsCfApi::statTypeVirtualFile(csync_file_stat_t *stat, void *statData) } else if (isSparseFile && isPinned) { stat->type = ItemTypeVirtualFileDownload; return true; - } else if (!isSparseFile && isUnpinned && !isWindowsShortcut){ + } else if (!isSparseFile && isUnpinned && !isWindowsShortcut && !isExcludeFile) { stat->type = ItemTypeVirtualFileDehydration; return true; } else if (isSparseFile) {