Added .lnk file placeholder creation fix.
authorallexzander <blackslayer4@gmail.com>
Wed, 31 Mar 2021 13:36:13 +0000 (16:36 +0300)
committerallexzander (Rebase PR Action) <allexzander@users.noreply.github.com>
Wed, 7 Apr 2021 09:08:02 +0000 (09:08 +0000)
Signed-off-by: allexzander <blackslayer4@gmail.com>
src/libsync/discovery.cpp
src/libsync/syncengine.cpp

index 7d12a8acddb3beb051602c76faf096155a7d4c15..47b4f2cf5517d5257545bc4fa85a106e148146ef 100644 (file)
@@ -14,6 +14,9 @@
 
 #include "discovery.h"
 #include "common/syncjournaldb.h"
+#ifdef Q_OS_WIN
+#include "common/filesystembase.h"
+#endif
 #include "syncfileitem.h"
 #include <QDebug>
 #include <algorithm>
@@ -501,22 +504,16 @@ void ProcessDirectoryJob::processFileAnalyzeRemoteInfo(
                 });
             return;
         }
-#ifdef Q_OS_WIN
-        const bool forceAlwaysLocal = item->_type == ItemTypeFile && item->_fileId.endsWith(".lnk");
-#else
-        const bool forceAlwaysLocal = false;
-#endif
-        if (forceAlwaysLocal) {
-            int a = 5;
-            a = 6;
-        }
         // Turn new remote files into virtual files if the option is enabled.
         auto &opts = _discoveryData->_syncOptions;
         if (!localEntry.isValid()
             && item->_type == ItemTypeFile
             && opts._vfs->mode() != Vfs::Off
             && _pinState != PinState::AlwaysLocal
-            && !forceAlwaysLocal) {
+#ifdef Q_OS_WIN
+            && !FileSystem::isLnkFile(path._server)
+#endif
+            ) {
             item->_type = ItemTypeVirtualFile;
             if (isVfsWithSuffix())
                 addVirtualFileSuffix(tmp_path._original);
index f6a23261a2a481d3ccec0b1b53dc93ae6dda2dd8..086da5cac056e02c8c590a8095cb08a901910e93 100644 (file)
@@ -345,7 +345,11 @@ void OCC::SyncEngine::slotItemDiscovered(const OCC::SyncFileItemPtr &item)
             rec._serverHasIgnoredFiles |= prev._serverHasIgnoredFiles;
 
             // Ensure it's a placeholder file on disk
-            if (item->_type == ItemTypeFile) {
+            if (item->_type == ItemTypeFile
+#ifdef Q_OS_WIN
+                    && !FileSystem::isLnkFile(filePath)
+#endif
+                    ) {
                 const auto result = _syncOptions._vfs->convertToPlaceholder(filePath, *item);
                 if (!result) {
                     item->_instruction = CSYNC_INSTRUCTION_ERROR;