Browse Source

lib/config: Set DisableTempIndexes to true on receive-encrypted (#7701)

Simon Frei 4 years ago
parent
commit
0126188ba7
2 changed files with 28 additions and 0 deletions
  1. 27 0
      lib/config/config_test.go
  2. 1 0
      lib/config/folderconfiguration.go

+ 27 - 0
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")
+	}
+}

+ 1 - 0
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
 	}
 }