From f80127d75a2277746e45ade078ceffcd22ccee76 Mon Sep 17 00:00:00 2001 From: Sild Date: Wed, 7 Feb 2024 12:51:33 +0100 Subject: [PATCH] use PathEncode in SnippetFileContent for filename --- snippets.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/snippets.go b/snippets.go index c25548b12..7c7c8084e 100644 --- a/snippets.go +++ b/snippets.go @@ -20,7 +20,6 @@ import ( "bytes" "fmt" "net/http" - "net/url" "time" ) @@ -136,7 +135,7 @@ func (s *SnippetsService) SnippetContent(snippet int, options ...RequestOptionFu // GitLab API docs: // https://docs.gitlab.com/ee/api/snippets.html#snippet-repository-file-content func (s *SnippetsService) SnippetFileContent(snippet int, ref, filename string, options ...RequestOptionFunc) ([]byte, *Response, error) { - filepath := url.QueryEscape(filename) + filepath := PathEscape(filename) u := fmt.Sprintf("snippets/%d/files/%s/%s/raw", snippet, ref, filepath) req, err := s.client.NewRequest(http.MethodGet, u, nil, options)