Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic when listing user repos using API and not authenticated #1540

Closed
2 of 7 tasks
cez81 opened this issue Apr 25, 2017 · 2 comments · Fixed by #1622
Closed
2 of 7 tasks

Panic when listing user repos using API and not authenticated #1540

cez81 opened this issue Apr 25, 2017 · 2 comments · Fixed by #1622
Labels
Milestone

Comments

@cez81
Copy link
Contributor

cez81 commented Apr 25, 2017

/home/jonas/go/src/code.gitea.io/gitea/routers/api/v1/user/repo.go:12 (0x101b389)
	listUserRepos: showPrivateRepos := (ctx.User.ID == userID || ctx.User.IsAdmin) && ctx.IsSigned
/home/jonas/go/src/code.gitea.io/gitea/routers/api/v1/user/repo.go:40 (0x101b764)
	ListUserRepos: listUserRepos(ctx, user)

Description

Trying to get users repositories using the API when not signed in will cause panic on line https://github.com/go-gitea/gitea/blob/master/routers/api/v1/user/repo.go#L12.
ctx.User is not populated unless signed in.

Github seems to allow this operation even when nog logged in so I guess that should be correct behaviour?

@bkcsoft
Copy link
Member

bkcsoft commented Apr 25, 2017

Related to #1539 which has the same issue (but for the web-view controller)

@lunny lunny added this to the 1.2.0 milestone Apr 26, 2017
@lunny lunny added the type/bug label Apr 26, 2017
@go-gitea go-gitea locked and limited conversation to collaborators Nov 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants
@lunny @bkcsoft @cez81 and others