浏览代码

lib/model: Prevent folder-type change from/to encrypted (fixes #7704) (#7796)

Simon Frei 4 年之前
父节点
当前提交
89e762fd6e
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      lib/model/model.go

+ 7 - 0
lib/model/model.go

@@ -2767,6 +2767,13 @@ func (m *model) String() string {
 }
 
 func (m *model) VerifyConfiguration(from, to config.Configuration) error {
+	toFolders := to.FolderMap()
+	for _, from := range from.Folders {
+		to, ok := toFolders[from.ID]
+		if ok && from.Type != to.Type && (from.Type == config.FolderTypeReceiveEncrypted || to.Type == config.FolderTypeReceiveEncrypted) {
+			return errors.New("folder type must not be changed from/to receive-encrypted")
+		}
+	}
 	return nil
 }