diff options
author | alex-z <blackslayer4@gmail.com> | 2022-09-21 19:14:03 +0300 |
---|---|---|
committer | backportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com> | 2022-10-03 14:36:16 +0300 |
commit | f141b3d2d03b8149acb8612705c092be9252606f (patch) | |
tree | 774fdcd87ff367d1b0ee370b7d8d2493c6b9000f | |
parent | f9c8bf4cec17d08c2002d72211775f681ab5bd16 (diff) |
Bring back .lnk files on Windows and always treat them as non-virtual files.
Signed-off-by: alex-z <blackslayer4@gmail.com>
-rw-r--r-- | src/csync/vio/csync_vio_local_win.cpp | 3 | ||||
-rw-r--r-- | src/libsync/discovery.cpp | 16 | ||||
-rw-r--r-- | src/libsync/vfs/cfapi/vfs_cfapi.cpp | 5 |
3 files changed, 9 insertions, 15 deletions
diff --git a/src/csync/vio/csync_vio_local_win.cpp b/src/csync/vio/csync_vio_local_win.cpp index 4ddd4f545..dfb33742c 100644 --- a/src/csync/vio/csync_vio_local_win.cpp +++ b/src/csync/vio/csync_vio_local_win.cpp @@ -162,8 +162,7 @@ std::unique_ptr<csync_file_stat_t> csync_vio_local_readdir(csync_vio_handle_t *h } else if (handle->ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { file_stat->type = ItemTypeDirectory; } else { - // exclude ".lnk" files as they are not essential, but, causing troubles when enabling the VFS due to QFileInfo::isDir() and other methods are freezing, which causes the ".lnk" files to start hydrating and freezing the app eventually. - file_stat->type = !OCC::FileSystem::isLnkFile(path) ? ItemTypeFile : ItemTypeSoftLink; + file_stat->type = ItemTypeFile; } /* Check for the hidden flag */ diff --git a/src/libsync/discovery.cpp b/src/libsync/discovery.cpp index a437dc48d..df975fe0e 100644 --- a/src/libsync/discovery.cpp +++ b/src/libsync/discovery.cpp @@ -254,18 +254,7 @@ bool ProcessDirectoryJob::handleExcluded(const QString &path, const Entries &ent } } -#ifdef Q_OS_WIN - // exclude ".lnk" files as they are not essential, but, causing troubles when enabling the VFS due to - // QFileInfo::isDir() and other methods are freezing, which causes the ".lnk" files to start hydrating and freezing - // the app eventually. - const bool isServerEntryWindowsShortcut = !entries.localEntry.isValid() && entries.serverEntry.isValid() - && !entries.serverEntry.isDirectory && FileSystem::isLnkFile(entries.serverEntry.name); -#else - const bool isServerEntryWindowsShortcut = false; -#endif - const auto isSymlink = entries.localEntry.isSymLink || isServerEntryWindowsShortcut; - - if (excluded == CSYNC_NOT_EXCLUDED && !isSymlink) { + if (excluded == CSYNC_NOT_EXCLUDED && !entries.localEntry.isSymLink) { return false; } else if (excluded == CSYNC_FILE_SILENTLY_EXCLUDED || excluded == CSYNC_FILE_EXCLUDE_AND_REMOVE) { emit _discoveryData->silentlyExcluded(path); @@ -277,7 +266,7 @@ bool ProcessDirectoryJob::handleExcluded(const QString &path, const Entries &ent item->_originalFile = path; item->_instruction = CSYNC_INSTRUCTION_IGNORE; - if (isSymlink) { + if (entries.localEntry.isSymLink) { /* Symbolic links are ignored. */ item->_errorString = tr("Symbolic links are not supported in syncing."); } else { @@ -640,6 +629,7 @@ void ProcessDirectoryJob::processFileAnalyzeRemoteInfo( if (!localEntry.isValid() && item->_type == ItemTypeFile && opts._vfs->mode() != Vfs::Off + && !FileSystem::isLnkFile(item->_file) && _pinState != PinState::AlwaysLocal && !FileSystem::isExcludeFile(item->_file)) { item->_type = ItemTypeVirtualFile; diff --git a/src/libsync/vfs/cfapi/vfs_cfapi.cpp b/src/libsync/vfs/cfapi/vfs_cfapi.cpp index d201e36c4..3893f6393 100644 --- a/src/libsync/vfs/cfapi/vfs_cfapi.cpp +++ b/src/libsync/vfs/cfapi/vfs_cfapi.cpp @@ -211,6 +211,11 @@ Result<void, QString> VfsCfApi::dehydratePlaceholder(const SyncFileItem &item) Result<Vfs::ConvertToPlaceholderResult, QString> VfsCfApi::convertToPlaceholder(const QString &filename, const SyncFileItem &item, const QString &replacesFile) { + if (item._type != ItemTypeDirectory && OCC::FileSystem::isLnkFile(filename)) { + qCInfo(lcCfApi) << "File \"" << filename << "\" is a Windows shortcut. Not converting it to a placeholder."; + return Vfs::ConvertToPlaceholderResult::Ok; + } + const auto localPath = QDir::toNativeSeparators(filename); const auto replacesPath = QDir::toNativeSeparators(replacesFile); |