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

This commit is contained in:
Simon Frei 2021-07-03 13:47:04 +02:00 committed by GitHub
parent a63d3ee625
commit 89e762fd6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -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
}