mirror of
https://github.com/Prowlarr/Prowlarr
synced 2025-12-29 03:43:25 +01:00
Fixed: (CardigannBase) Remedy for casting strings to booleans
This commit is contained in:
parent
caa8bb05a7
commit
34c560fd3a
1 changed files with 9 additions and 4 deletions
|
|
@ -300,7 +300,12 @@ protected Dictionary<string, object> GetBaseTemplateVariables()
|
|||
}
|
||||
else if (setting.Type == "checkbox")
|
||||
{
|
||||
variables[name] = ((bool)value) ? ".True" : null;
|
||||
if (value is string stringValue && bool.TryParse(stringValue, out var result))
|
||||
{
|
||||
value = result;
|
||||
}
|
||||
|
||||
variables[name] = (bool)value ? ".True" : null;
|
||||
}
|
||||
else if (setting.Type == "select")
|
||||
{
|
||||
|
|
@ -328,12 +333,12 @@ protected Dictionary<string, object> GetBaseTemplateVariables()
|
|||
}
|
||||
else
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
throw new NotSupportedException($"Type {setting.Type} is not supported.");
|
||||
}
|
||||
|
||||
if (setting.Type != "password" && setting.Name != "apikey" && setting.Name != "rsskey" && indexerLogging)
|
||||
if (setting.Type != "password" && setting.Name != "apikey" && setting.Name != "rsskey" && indexerLogging && variables.ContainsKey(name))
|
||||
{
|
||||
_logger.Debug($"Setting {setting.Name} to {variables[name]}");
|
||||
_logger.Debug($"Setting {setting.Name} to {variables[name].ToJson()}");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue