diff --git a/src/NzbDrone.Api/Config/MediaManagementConfigResource.cs b/src/NzbDrone.Api/Config/MediaManagementConfigResource.cs index a51e8b4d3..097ecc693 100644 --- a/src/NzbDrone.Api/Config/MediaManagementConfigResource.cs +++ b/src/NzbDrone.Api/Config/MediaManagementConfigResource.cs @@ -44,7 +44,8 @@ public static MediaManagementConfigResource ToResource(IConfigService model) SkipFreeSpaceCheckWhenImporting = model.SkipFreeSpaceCheckWhenImporting, CopyUsingHardlinks = model.CopyUsingHardlinks, - EnableMediaInfo = model.EnableMediaInfo, + ExtraFileExtensions = model.ExtraFileExtensions, + EnableMediaInfo = model.EnableMediaInfo }; } } diff --git a/src/NzbDrone.Core.Test/Configuration/ConfigServiceFixture.cs b/src/NzbDrone.Core.Test/Configuration/ConfigServiceFixture.cs index 6ce968612..8ad51f1e7 100644 --- a/src/NzbDrone.Core.Test/Configuration/ConfigServiceFixture.cs +++ b/src/NzbDrone.Core.Test/Configuration/ConfigServiceFixture.cs @@ -108,5 +108,19 @@ public void config_properties_should_write_and_read_using_same_key() keys.Should().OnlyHaveUniqueItems(); } + + [Test] + public void should_ignore_null_properties() + { + Mocker.GetMock() + .Setup(v => v.Get("downloadedepisodesfolder")) + .Returns(new Config { Id = 1, Key = "DownloadedEpisodesFolder", Value = @"C:\test".AsOsAgnostic() }); + + var dict = new Dictionary(); + dict.Add("DownloadedEpisodesFolder", null); + Subject.SaveConfigDictionary(dict); + + Mocker.GetMock().Verify(c => c.Upsert("downloadedepisodesfolder", It.IsAny()), Times.Never()); + } } -} \ No newline at end of file +} diff --git a/src/NzbDrone.Core/Configuration/ConfigService.cs b/src/NzbDrone.Core/Configuration/ConfigService.cs index a04dba0e5..e1ac74ee8 100644 --- a/src/NzbDrone.Core/Configuration/ConfigService.cs +++ b/src/NzbDrone.Core/Configuration/ConfigService.cs @@ -55,7 +55,7 @@ public void SaveConfigDictionary(Dictionary configValues) { object currentValue; allWithDefaults.TryGetValue(configValue.Key, out currentValue); - if (currentValue == null) continue; + if (currentValue == null || configValue.Value == null) continue; var equal = configValue.Value.ToString().Equals(currentValue.ToString());