From c4e77f34ce0f576ceb260e2b3756d0f2c303806d Mon Sep 17 00:00:00 2001 From: Avish Porwal Date: Sat, 29 Nov 2025 15:30:31 +0530 Subject: [PATCH] Fix issue-743 by sanitizing the URL --- cmd/publisher/commands/init.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmd/publisher/commands/init.go b/cmd/publisher/commands/init.go index 6a7381d6..d1ac9a10 100644 --- a/cmd/publisher/commands/init.go +++ b/cmd/publisher/commands/init.go @@ -213,6 +213,10 @@ func detectDescription() string { } func detectRepoURL() string { + sanitizeURL := func(url string) string { + return strings.TrimPrefix(url, "git+") + } + // Try git remote ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() @@ -233,11 +237,11 @@ func detectRepoURL() string { if json.Unmarshal(data, &pkg) == nil { if repo, ok := pkg["repository"].(map[string]any); ok { if url, ok := repo["url"].(string); ok { - return strings.TrimSuffix(url, ".git") + return sanitizeURL(strings.TrimSuffix(url, ".git")) } } if repo, ok := pkg["repository"].(string); ok { - return strings.TrimSuffix(repo, ".git") + return sanitizeURL(strings.TrimSuffix(repo, ".git")) } } }