Fix adding multiple interpolated expressions with the same format to admin logs
Add test case
This commit is contained in:
@@ -40,7 +40,23 @@ public ref struct LogStringHandler
|
||||
format = argument[0] == '@' ? argument[1..] : argument;
|
||||
}
|
||||
|
||||
Values.Add(format, value);
|
||||
if (!Values.TryAdd(format, value))
|
||||
{
|
||||
if (Values[format] == (object?) value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var originalFormat = format;
|
||||
var i = 2;
|
||||
format = $"{originalFormat}_{i}";
|
||||
|
||||
while (!Values.TryAdd(format, value))
|
||||
{
|
||||
format = $"{originalFormat}_{i}";
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void AppendLiteral(string value)
|
||||
|
||||
Reference in New Issue
Block a user