fix: Fixes detecting consecutive exceptions in name validation (#2192)

This commit is contained in:
Kamron Batman 2025-05-18 21:02:05 -07:00 committed by GitHub
parent f630ec2a2d
commit 5de42d94fc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -216,6 +216,7 @@ public static class NameVerification
}
var index = name.IndexOfAny(exceptions);
var exceptionCount = 0;
while (index != -1)
{
@ -229,7 +230,7 @@ public static class NameVerification
noExceptionsAtStart = false;
}
if (maxExceptions-- <= 0)
if (exceptionCount++ >= maxExceptions)
{
return true;
}
@ -238,6 +239,10 @@ public static class NameVerification
{
name = name[(index + 1)..];
index = name.IndexOfAny(exceptions);
if (index != 0)
{
exceptionCount = 0;
}
}
else
{