-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[API] Subscribing user to issue produces nil in API reponse #18090
Comments
This can only occur if you're trying to subscribe a user that isn't the logged in user or you're not the admin. It will be coming from //only admin and user for itself can change subscription
if user.ID != ctx.User.ID && !ctx.User.IsAdmin {
ctx.Error(http.StatusForbidden, "User", nil)
return
} |
The error(403 forbidden) is alright and is working according to spec but I was referring to the message. It's a minor thing but a descriptive error message might come in handy while debugging |
zeripath
added a commit
to zeripath/gitea
that referenced
this issue
Dec 24, 2021
…nied Fix go-gitea#18090 Signed-off-by: Andrew Thornton <art27@cantab.net>
Chianina
pushed a commit
to Chianina/gitea
that referenced
this issue
Mar 28, 2022
…nied (go-gitea#18091) Fix go-gitea#18090 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Gitea Version
743-g7cc44491f
Git Version
No response
Operating System
No response
How are you running Gitea?
Tested on https://try.gitea.io
Database
No response
Can you reproduce the bug on the Gitea demo site?
Yes
Log Gist
No response
Description
When subscribing a user through the API to an issue, it returns the following error when the operation is forbidden:
This is probably harmless but can be fixed to return an appropriate error message like so:
The problem seems to be in this line:
gitea/routers/api/v1/repo/issue_subscription.go
Line 131 in 7cc4449
I'll be happy to submit a patch to this effect!
Screenshots
The text was updated successfully, but these errors were encountered: