Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

Commit

Permalink
use PathEncode in SnippetFileContent for filename
Browse files Browse the repository at this point in the history
  • Loading branch information
Sild authored Feb 7, 2024
1 parent d89a43d commit f80127d
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions snippets.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"bytes"
"fmt"
"net/http"
"net/url"
"time"
)

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit f80127d

Please sign in to comment.