Fix encoding of external map in preset

The effect of this is that refreshed infrastructures were not
remembered.
This commit is contained in:
Davide De Rosa 2019-04-28 21:31:53 +02:00
parent 24e3ca5ed7
commit 125c6a7d67
1 changed files with 7 additions and 1 deletions

View File

@ -205,7 +205,13 @@ public struct InfrastructurePreset: Codable {
try container.encode(id, forKey: .id)
try container.encode(name, forKey: .name)
try container.encode(comment, forKey: .comment)
try container.encodeIfPresent(external, forKey: .external)
if let external = external {
var rawExternal: [String: String] = [:]
for entry in external {
rawExternal[entry.key.rawValue] = entry.value
}
try container.encodeIfPresent(rawExternal, forKey: .external)
}
var cfgContainer = container.nestedContainer(keyedBy: ConfigurationKeys.self, forKey: .configuration)
try cfgContainer.encode(configuration.sessionConfiguration.cipher, forKey: .cipher)