SyncOptions: Add default placeholder suffix
authorChristian Kamm <mail@ckamm.de>
Mon, 29 Jan 2018 10:16:50 +0000 (11:16 +0100)
committerKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 15 Dec 2020 09:57:49 +0000 (10:57 +0100)
Otherwise each test has to set this up anew.

src/libsync/syncengine.cpp
src/libsync/syncoptions.h

index 5770a5d3a379d5bd5df86869fada3d4917749981..93cab726f034d9dd11ec1207604ad0f6882da058 100644 (file)
@@ -861,6 +861,12 @@ void SyncEngine::startSync()
     _csync_ctx->new_files_are_placeholders = _syncOptions._newFilesArePlaceholders;
     _csync_ctx->placeholder_suffix = _syncOptions._placeholderSuffix.toUtf8();
 
+    if (_csync_ctx->new_files_are_placeholders && _csync_ctx->placeholder_suffix.isEmpty()) {
+        csyncError(tr("Using placeholder files, but placeholder suffix is not set"));
+        finalize(false);
+        return;
+    }
+
     // If needed, make sure we have up to date E2E information before the
     // discovery phase, otherwise we start right away
     if (_account->capabilities().clientSideEncryptionAvailable()) {
index 2e302bda94e82c6e22eb13b27699cbf54aa48c46..ea48cd83e1124bcd70cb341e51cb7057df2c125d 100644 (file)
@@ -38,7 +38,7 @@ struct SyncOptions
 
     /** Create a placeholder for new files instead of downloading */
     bool _newFilesArePlaceholders = false;
-    QString _placeholderSuffix;
+    QString _placeholderSuffix = ".owncloud";
 
     /** The initial un-adjusted chunk size in bytes for chunked uploads, both
      * for old and new chunking algorithm, which classifies the item to be chunked