fix migration of existing windows shortcut files to placeholder
authorMatthieu Gallien <matthieu.gallien@nextcloud.com>
Tue, 5 Nov 2024 16:32:53 +0000 (17:32 +0100)
committerMatthieu Gallien <matthieu.gallien@nextcloud.com>
Fri, 22 Nov 2024 08:50:08 +0000 (09:50 +0100)
we cannot do a single call to convert the plain old file to be a
dehydrated virtual file placeholder

split the conversion into a separate initial API call

fix transition from releases < 3.14 to current releases that have first
class support for windows shortcuts (so called link files)

Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
src/libsync/propagatedownload.cpp

index 9fcc3988fb78e43ae10514d4660b4c63c17c169a..b6474ea54df9ecf5a51f3ce93a7c1df0b4b1f5e5 100644 (file)
@@ -498,6 +498,13 @@ void PropagateDownloadFile::startAfterIsEncryptedIsChecked()
         }
 
         qCDebug(lcPropagateDownload) << "dehydrating file" << _item->_file;
+        if (FileSystem::isLnkFile(fsPath)) {
+            const auto convertResult = vfs->convertToPlaceholder(fsPath, *_item);
+            if (!convertResult) {
+                qCCritical(lcPropagateDownload()) << "error when converting a shortcut file to placeholder" << convertResult.error();
+            }
+        }
+
         auto r = vfs->dehydratePlaceholder(*_item);
         if (!r) {
             done(SyncFileItem::NormalError, r.error(), ErrorCategory::GenericError);