-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Open
Description
P2: Path concatenation can produce a double-slash when BaseAddress.AbsolutePath ends with '/', resulting in a different URL path (e.g., /api//widgets/{id}) that may not match server routes.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/csharp/generichost/latest/NullTypes/src/Org.OpenAPITools/Api/DefaultApi.cs, line 236:
<comment>Path concatenation can produce a double-slash when BaseAddress.AbsolutePath ends with '/', resulting in a different URL path (e.g., /api//widgets/{id}) that may not match server routes.</comment>
<file context>
@@ -0,0 +1,383 @@
+ uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme;
+ uriBuilderLocalVar.Path = HttpClient.BaseAddress.AbsolutePath == "/"
+ ? "/widgets/{id}"
+ : string.Concat(HttpClient.BaseAddress.AbsolutePath, "/widgets/{id}");
+ uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Bid%7D", Uri.EscapeDataString(id.ToString()));
+
</file context>
Originally posted by @cubic-dev-ai[bot] in #23260 (comment)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels