fix(router): ship audit bundle frontdoor cutover
This commit is contained in:
@@ -45,6 +45,8 @@ public static class GatewayOptionsValidator
|
||||
|
||||
private static void ValidateRoutes(List<StellaOpsRoute> routes)
|
||||
{
|
||||
var exactPathIndices = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
for (var i = 0; i < routes.Count; i++)
|
||||
{
|
||||
var route = routes[i];
|
||||
@@ -66,6 +68,17 @@ public static class GatewayOptionsValidator
|
||||
throw new InvalidOperationException($"{prefix}: Path is not a valid regex pattern: {ex.Message}");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var normalizedPath = NormalizePath(route.Path);
|
||||
if (exactPathIndices.TryGetValue(normalizedPath, out var existingIndex))
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
$"{prefix}: Duplicate route path '{normalizedPath}' already defined by Route[{existingIndex}].");
|
||||
}
|
||||
|
||||
exactPathIndices[normalizedPath] = i;
|
||||
}
|
||||
|
||||
switch (route.Type)
|
||||
{
|
||||
@@ -124,4 +137,16 @@ public static class GatewayOptionsValidator
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static string NormalizePath(string value)
|
||||
{
|
||||
var normalized = value.Trim();
|
||||
if (!normalized.StartsWith('/'))
|
||||
{
|
||||
normalized = "/" + normalized;
|
||||
}
|
||||
|
||||
normalized = normalized.TrimEnd('/');
|
||||
return string.IsNullOrEmpty(normalized) ? "/" : normalized;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user