Fixed: XML clean extra spaces from config file settings when saving/retrieving

pull/49/merge
Mark McDowall 11 years ago
parent e00b216eef
commit a422587ed5

@ -197,7 +197,7 @@ namespace NzbDrone.Core.Configuration
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 @@ namespace NzbDrone.Core.Configuration
{
EnsureDefaultConfigFile();
var valueString = value.ToString().Trim();
var xDoc = LoadConfigFile();
var config = xDoc.Descendants(CONFIG_ELEMENT_NAME).Single();
@ -223,15 +224,15 @@ namespace NzbDrone.Core.Configuration
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…
Cancel
Save