From 0126188ba7c652da06199a4c9264d67d6cda786f Mon Sep 17 00:00:00 2001 From: Simon Frei Date: Thu, 20 May 2021 22:33:23 +0200 Subject: [PATCH] lib/config: Set DisableTempIndexes to true on receive-encrypted (#7701) --- lib/config/config_test.go | 27 +++++++++++++++++++++++++++ lib/config/folderconfiguration.go | 1 + 2 files changed, 28 insertions(+) diff --git a/lib/config/config_test.go b/lib/config/config_test.go index d253cdcff..e49aa9776 100644 --- a/lib/config/config_test.go +++ b/lib/config/config_test.go @@ -1343,3 +1343,30 @@ func TestInternalVersioningConfiguration(t *testing.T) { } } } + +func TestReceiveEncryptedFolderFixed(t *testing.T) { + cfg := Configuration{ + Folders: []FolderConfiguration{ + { + ID: "foo", + Path: "testdata", + Type: FolderTypeReceiveEncrypted, + DisableTempIndexes: false, + IgnorePerms: false, + }, + }, + } + + cfg.prepare(device1) + + if len(cfg.Folders) != 1 { + t.Fatal("Expected one folder") + } + f := cfg.Folders[0] + if !f.DisableTempIndexes { + t.Error("DisableTempIndexes should be true") + } + if !f.IgnorePerms { + t.Error("IgnorePerms should be true") + } +} diff --git a/lib/config/folderconfiguration.go b/lib/config/folderconfiguration.go index a4c5a41a5..c8e327a54 100644 --- a/lib/config/folderconfiguration.go +++ b/lib/config/folderconfiguration.go @@ -214,6 +214,7 @@ func (f *FolderConfiguration) prepare(myID protocol.DeviceID, existingDevices ma } if f.Type == FolderTypeReceiveEncrypted { + f.DisableTempIndexes = true f.IgnorePerms = true } }