| 1 | namespace AgentForge.Abstractions; |
| 2 | |
| 3 | public static class ForgeRepoNames |
| 4 | { |
| 5 | private const char OrgPathSeparator = '~'; |
| 6 | |
| 7 | public static string NormalizeRoute(string? repoName) |
| 8 | { |
| 9 | if (string.IsNullOrWhiteSpace(repoName)) |
| 10 | return string.Empty; |
| 11 | var trimmed = repoName.Trim().Trim('/'); |
| 12 | if (trimmed.Contains('%', StringComparison.Ordinal)) |
| 13 | trimmed = Uri.UnescapeDataString(trimmed); |
| 14 | return trimmed.Replace(OrgPathSeparator, '/'); |
| 15 | } |
| 16 | |
| 17 | /// <summary>Single route segment — org slashes become <c>~</c> (ASP.NET rejects %2F in paths).</summary> |
| 18 | public static string ToUrlPath(string repoName) => |
| 19 | NormalizeRoute(repoName).Replace('/', OrgPathSeparator); |
| 20 | } |
| 21 | |
View only · write via MCP/CIDE