Skip to content

Error 500 on comment creation via API, with sudo #5871

@jlecour

Description

@jlecour
  • Gitea version (or commit ref): 1.7.0
  • Git version: 2.20.1
  • Operating system: Deban 9.6
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

I've been using the API to import projects and issues from Redmine/Gitolite to Gitea (it will be open sourced soon).
For a few days I've been using a Gitea instance with a version < 1.7 and it seemed to work really well. I could create issues and comments on repositories, with or without the Sudo header.
It seems that after the 1.7 upgrade I can't use Sudo anymore.
My request fail if I add the HTTP header. I get the same error with the query string parameter.

Examples :

# this one works
curl -v -X POST "https://my-gitea/api/v1/repos/jlecour/tests-redmine-to-gitea/issues/1/comments" -H "accept: application/json" -H "Authorization: token XXX" -H "Content-Type: application/json" -d "{ \"body\": \"comment body\"}"

# this one doesn't work (error 500)
curl -v -X POST "https://my-gitea/api/v1/repos/jlecour/tests-redmine-to-gitea/issues/1/comments" -H "accept: application/json" -H "Authorization: token XXX" -H "Content-Type: application/json" -d "{ \"body\": \"comment body\"}" -H "Sudo: other_user"

Obviously other_user exists and is a collaborator on the repository with Write permission.

In the logs, I only get SQL logs with a failed transaction (ROLLBACK). I've executed each request manually against my database and I get no error, so I guess the faulty request is not logged.

I'm not sure if it's a bug or if I did something wrong.
Is there a way to have more information about the error ?

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