Skip to content

Commit

Permalink
Check for dictionary type first
Browse files Browse the repository at this point in the history
  • Loading branch information
russcam committed Oct 22, 2020
1 parent 79077dd commit 01c23c5
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,12 @@ protected override JsonProperty CreateProperty(MemberInfo member, MemberSerializ
: new TruncateJsonConverter(maxLengthAttribute.Length);
}
}

var sanitizeAttribute = member.GetCustomAttribute<SanitizeAttribute>();

if (sanitizeAttribute != null && property.PropertyType == typeof(Dictionary<string, string>))
property.Converter = _headerDictionarySanitizerConverter;
else if (property.PropertyType == typeof(Dictionary<string, string>))
{
var sanitizeAttribute = member.GetCustomAttribute<SanitizeAttribute>();
if (sanitizeAttribute != null)
property.Converter = _headerDictionarySanitizerConverter;
}

return property;
}
Expand Down

0 comments on commit 01c23c5

Please sign in to comment.