Skip to content

Commit fc4121a

Browse files
committed
Look for the exact projectName in the returned project list
When fetching a project by name, a list is returned. If implented, this will make sure we return the right project from the list. Signed-off-by: Soule BA <[email protected]>
1 parent 5d55818 commit fc4121a

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)