From 7278a709f2f403498d526cc6ee7a74cf35172255 Mon Sep 17 00:00:00 2001 From: Landon Cox Date: Sun, 5 Apr 2026 15:17:48 -0700 Subject: [PATCH] Fix search_repositories query parameter URL encoding The search_repositories case in restBackendCaller.CallTool was not URL-encoding the query parameter before embedding it in the API path. Characters like spaces and '>' in queries (e.g. 'language:go stars:>1000') produced malformed HTTP request URIs, causing the upstream server to reject them with HTTP 400 instead of forwarding to the /search/repositories endpoint. Use url.QueryEscape to properly encode the query value. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- internal/proxy/proxy.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/proxy/proxy.go b/internal/proxy/proxy.go index 581e1619..eea9a2fe 100644 --- a/internal/proxy/proxy.go +++ b/internal/proxy/proxy.go @@ -324,7 +324,7 @@ func (r *restBackendCaller) CallTool(ctx context.Context, toolName string, args if pp, ok := argsMap["perPage"].(float64); ok { perPage = fmt.Sprintf("%d", int(pp)) } - apiPath = fmt.Sprintf("/search/repositories?q=%s&per_page=%s", query, perPage) + apiPath = fmt.Sprintf("/search/repositories?q=%s&per_page=%s", url.QueryEscape(query), perPage) case "get_collaborator_permission": owner, _ := argsMap["owner"].(string)