Skip to content

Commit 3be74ba

Browse files
authored
Merge pull request #146 from fluxcd/iterate-on-projects-prior-to-retunring-it
[Stash] Look for the exact projectName in the returned project list
2 parents 5d55818 + fc4121a commit 3be74ba

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

stash/projects.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,16 @@ func (s *ProjectsService) Get(ctx context.Context, projectName string) (*Project
172172
return nil, ErrNotFound
173173
}
174174

175-
p.Projects[0].Session.set(resp)
176-
return p.Projects[0], nil
175+
// find the project
176+
for i := range p.Projects {
177+
if p.Projects[i].Name == projectName {
178+
// Found!
179+
p.Projects[i].Session.set(resp)
180+
return p.Projects[i], nil
181+
}
182+
}
183+
184+
return nil, ErrNotFound
177185

178186
}
179187

0 commit comments

Comments
 (0)