aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Common/Extensions.cs2
-rw-r--r--src/slskd/Common/Redactor.cs14
2 files changed, 9 insertions, 7 deletions
diff --git a/src/slskd/Common/Extensions.cs b/src/slskd/Common/Extensions.cs
index be5bcf16..0f3f8362 100644
--- a/src/slskd/Common/Extensions.cs
+++ b/src/slskd/Common/Extensions.cs
@@ -318,7 +318,7 @@ namespace slskd
public static Options Redact(this Options options)
{
var redacted = options.ToJson().FromJson<Options>();
- Redactor.Redact(redacted);
+ Redactor.Redact(redacted, redactWith: "*****");
return redacted;
}
diff --git a/src/slskd/Common/Redactor.cs b/src/slskd/Common/Redactor.cs
index c695593b..b2069b12 100644
--- a/src/slskd/Common/Redactor.cs
+++ b/src/slskd/Common/Redactor.cs
@@ -44,18 +44,20 @@ namespace slskd
return;
}
- var props = target.GetType().GetProperties();
-
- foreach (var prop in props)
+ foreach (var prop in target.GetType().GetProperties())
{
var value = prop.GetValue(target);
- if (prop.GetCustomAttributes().Any(attr => attr.GetType() == typeof(SecretAttribute)) && prop.PropertyType == typeof(string) && value != null)
+ if (value == null)
{
- prop.SetValue(target, redactWith);
+ continue;
}
- if (value != null)
+ if (prop.GetCustomAttributes().Any(attr => attr.GetType() == typeof(SecretAttribute)) && prop.PropertyType == typeof(string))
+ {
+ prop.SetValue(target, redactWith);
+ }
+ else
{
if (value.GetType().IsAssignableTo(typeof(IEnumerable)))
{