mirror of
https://github.com/Radarr/Radarr
synced 2024-12-23 08:22:39 +00:00
Fixed: XML clean extra spaces from config file settings when saving/retrieving
This commit is contained in:
parent
e00b216eef
commit
a422587ed5
1 changed files with 5 additions and 4 deletions
|
@ -197,7 +197,7 @@ public string GetValue(string key, object defaultValue, bool persist = true)
|
|||
var valueHolder = parentContainer.Descendants(key).ToList();
|
||||
|
||||
if (valueHolder.Count() == 1)
|
||||
return valueHolder.First().Value;
|
||||
return valueHolder.First().Value.Trim();
|
||||
|
||||
//Save the value
|
||||
if (persist)
|
||||
|
@ -214,6 +214,7 @@ public void SetValue(string key, object value)
|
|||
{
|
||||
EnsureDefaultConfigFile();
|
||||
|
||||
var valueString = value.ToString().Trim();
|
||||
var xDoc = LoadConfigFile();
|
||||
var config = xDoc.Descendants(CONFIG_ELEMENT_NAME).Single();
|
||||
|
||||
|
@ -223,15 +224,15 @@ public void SetValue(string key, object value)
|
|||
|
||||
if (keyHolder.Count() != 1)
|
||||
{
|
||||
parentContainer.Add(new XElement(key, value));
|
||||
parentContainer.Add(new XElement(key, valueString));
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
parentContainer.Descendants(key).Single().Value = value.ToString();
|
||||
parentContainer.Descendants(key).Single().Value = valueString;
|
||||
}
|
||||
|
||||
_cache.Set(key, value.ToString());
|
||||
_cache.Set(key, valueString);
|
||||
|
||||
xDoc.Save(_configFile);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue