Skip to content

Commit 54744dd

Browse files
authored
Use url.PathEscape
1 parent c0b1554 commit 54744dd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scm/driver/gitea/git.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ package gitea
77
import (
88
"context"
99
"fmt"
10-
"strings"
1110
"time"
11+
"url"
1212

1313
"github.com/drone/go-scm/scm"
1414
)
@@ -25,7 +25,7 @@ func (s *gitService) FindBranch(ctx context.Context, repo, name string) (*scm.Re
2525
}
2626

2727
func (s *gitService) FindCommit(ctx context.Context, repo, ref string) (*scm.Commit, *scm.Response, error) {
28-
ref = strings.Replace(ref, "/", "%2F", -1)
28+
ref = url.PathEscape(ref)
2929
path := fmt.Sprintf("api/v1/repos/%s/git/commits/%s", repo, ref)
3030
out := new(commitInfo)
3131
res, err := s.client.do(ctx, "GET", path, nil, out)

0 commit comments

Comments
 (0)