Skip to content

[API] Subscribing user to issue produces nil in API reponse #18090

Closed
@realaravinth

Description

@realaravinth

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:

{
  "message": "%!s(<nil>)",
  "url": "https://try.gitea.io/api/swagger"
}

This is probably harmless but can be fixed to return an appropriate error message like so:

{
 "message": "Only admin and user for itself can change subscription",
"url": "https://try.gitea.io/api/swagger"
}

The problem seems to be in this line:

ctx.Error(http.StatusForbidden, "User", nil)

I'll be happy to submit a patch to this effect!

Screenshots

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions