Skip to content

Commit 971da4d

Browse files
authored
update list url to scopepath instead of path (#249)
1 parent 20ab723 commit 971da4d

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

scm/driver/azure/content.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ type contentService struct {
1919
func (s *contentService) Find(ctx context.Context, repo, path, ref string) (*scm.Content, *scm.Response, error) {
2020
// https://docs.microsoft.com/en-us/rest/api/azure/devops/git/items/get?view=azure-devops-rest-6.0
2121
if s.client.project == "" {
22-
return nil, nil, ProjectRequiredError()
23-
}
22+
return nil, nil, ProjectRequiredError()
23+
}
2424
endpoint := fmt.Sprintf("%s/%s/_apis/git/repositories/%s/items?path=%s&includeContent=true&$format=json", s.client.owner, s.client.project, repo, path)
2525
endpoint += generateURIFromRef(ref)
2626
endpoint += "&api-version=6.0"
@@ -37,8 +37,8 @@ func (s *contentService) Find(ctx context.Context, repo, path, ref string) (*scm
3737

3838
func (s *contentService) Create(ctx context.Context, repo, path string, params *scm.ContentParams) (*scm.Response, error) {
3939
if s.client.project == "" {
40-
return nil, ProjectRequiredError()
41-
}
40+
return nil, ProjectRequiredError()
41+
}
4242
endpoint := fmt.Sprintf("%s/%s/_apis/git/repositories/%s/pushes?api-version=6.0", s.client.owner, s.client.project, repo)
4343
ref := refUpdate{
4444
Name: SanitizeBranchName(params.Branch),
@@ -66,8 +66,8 @@ func (s *contentService) Create(ctx context.Context, repo, path string, params *
6666

6767
func (s *contentService) Update(ctx context.Context, repo, path string, params *scm.ContentParams) (*scm.Response, error) {
6868
if s.client.project == "" {
69-
return nil, ProjectRequiredError()
70-
}
69+
return nil, ProjectRequiredError()
70+
}
7171
endpoint := fmt.Sprintf("%s/%s/_apis/git/repositories/%s/pushes?api-version=6.0", s.client.owner, s.client.project, repo)
7272
ref := refUpdate{
7373
Name: SanitizeBranchName(params.Branch),
@@ -95,8 +95,8 @@ func (s *contentService) Update(ctx context.Context, repo, path string, params *
9595

9696
func (s *contentService) Delete(ctx context.Context, repo, path string, params *scm.ContentParams) (*scm.Response, error) {
9797
if s.client.project == "" {
98-
return nil, ProjectRequiredError()
99-
}
98+
return nil, ProjectRequiredError()
99+
}
100100
endpoint := fmt.Sprintf("%s/%s/_apis/git/repositories/%s/pushes?api-version=6.0", s.client.owner, s.client.project, repo)
101101
ref := refUpdate{
102102
Name: SanitizeBranchName(params.Branch),
@@ -122,9 +122,9 @@ func (s *contentService) Delete(ctx context.Context, repo, path string, params *
122122
func (s *contentService) List(ctx context.Context, repo, path, ref string, _ scm.ListOptions) ([]*scm.ContentInfo, *scm.Response, error) {
123123
// https://docs.microsoft.com/en-us/rest/api/azure/devops/git/items/list?view=azure-devops-rest-6.0
124124
if s.client.project == "" {
125-
return nil, nil, ProjectRequiredError()
126-
}
127-
endpoint := fmt.Sprintf("%s/%s/_apis/git/repositories/%s/items?path=%s&recursionLevel=Full&$format=json", s.client.owner, s.client.project, repo, path)
125+
return nil, nil, ProjectRequiredError()
126+
}
127+
endpoint := fmt.Sprintf("%s/%s/_apis/git/repositories/%s/items?scopePath=%s&recursionLevel=Full&$format=json", s.client.owner, s.client.project, repo, path)
128128
endpoint += generateURIFromRef(ref)
129129
out := new(contentList)
130130
res, err := s.client.do(ctx, "GET", endpoint, nil, &out)

0 commit comments

Comments
 (0)