mirror of
https://github.com/Radarr/Radarr
synced 2024-12-25 17:27:59 +00:00
Saving settings failed if value was null.
This commit is contained in:
parent
0411b82e65
commit
1251e294cd
3 changed files with 18 additions and 3 deletions
|
@ -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
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<IConfigRepository>()
|
||||
.Setup(v => v.Get("downloadedepisodesfolder"))
|
||||
.Returns(new Config { Id = 1, Key = "DownloadedEpisodesFolder", Value = @"C:\test".AsOsAgnostic() });
|
||||
|
||||
var dict = new Dictionary<string, object>();
|
||||
dict.Add("DownloadedEpisodesFolder", null);
|
||||
Subject.SaveConfigDictionary(dict);
|
||||
|
||||
Mocker.GetMock<IConfigRepository>().Verify(c => c.Upsert("downloadedepisodesfolder", It.IsAny<string>()), Times.Never());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ public void SaveConfigDictionary(Dictionary<string, object> 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());
|
||||
|
||||
|
|
Loading…
Reference in a new issue