gitea: Error 500 on comment creation via API, with sudo

  • 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 ?

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 36 (23 by maintainers)

Most upvoted comments

OK, I think I’ve spotted a different bug, because I wasn’t actually properly logging in… So I was getting a null pointer - which is bad enough to require a patch in itself…