Fixed: Setting SSL Cert Hash should remove all extra characters

pull/6/head
Mark McDowall 10 years ago
parent ac4f2d5e9a
commit 9056bc1747

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text.RegularExpressions;
using System.Xml; using System.Xml;
using System.Xml.Linq; using System.Xml.Linq;
using NzbDrone.Common; using NzbDrone.Common;
@ -49,6 +50,7 @@ namespace NzbDrone.Core.Configuration
private readonly ICached<string> _cache; private readonly ICached<string> _cache;
private readonly string _configFile; private readonly string _configFile;
private static readonly Regex HiddenCharacterRegex = new Regex("[^a-z0-9]", RegexOptions.Compiled | RegexOptions.IgnoreCase);
public ConfigFileProvider(IAppFolderInfo appFolderInfo, ICacheManager cacheManager, IEventAggregator eventAggregator) public ConfigFileProvider(IAppFolderInfo appFolderInfo, ICacheManager cacheManager, IEventAggregator eventAggregator)
{ {
@ -87,6 +89,12 @@ namespace NzbDrone.Core.Configuration
continue; continue;
} }
if (configValue.Key.Equals("SslCertHash", StringComparison.InvariantCultureIgnoreCase) && configValue.Value.ToString().IsNotNullOrWhiteSpace())
{
SetValue(configValue.Key.FirstCharToUpper(), HiddenCharacterRegex.Replace(configValue.Value.ToString(), String.Empty));
continue;
}
object currentValue; object currentValue;
allWithDefaults.TryGetValue(configValue.Key, out currentValue); allWithDefaults.TryGetValue(configValue.Key, out currentValue);
if (currentValue == null) continue; if (currentValue == null) continue;

Loading…
Cancel
Save