Skip to content

Deleting nonexistent user email via API causes internal server error #15357

Closed
@matusf

Description

@matusf
  • Gitea version (or commit ref): Gitea version 1.13.7 built with GNU Make 4.1, go1.15.11 : bindata, sqlite, sqlite_unlock_notify
  • Git version: git version 2.17.
  • Operating system: Ubuntu 18.04
  • Downloaded gitea from downloads page
  • Running as a command-line program
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
  • Log gist:
2021/04/09 01:45:57 Started DELETE /api/v1/user/emails for 127.0.0.1
2021/04/09 01:45:57 ...api/v1/user/email.go:128:DeleteEmail() [E] DeleteEmailAddresses: Email address does not exist
2021/04/09 01:45:57 Completed DELETE /api/v1/user/emails 500 Internal Server Error in 50.684576ms

Description

Make a DELETE request on /user/emails endpoint with supplied authorization token and invalid email in the body. Then 500 response is returned with following response body:

curl -v -X DELETE -H "Authorization: token $TOKEN" -d '{"emails":["xxx",""]}' 'http://localhost:2999/api/v1/user/emails' -H "Content-Type: application/json"
{"message":"","url":"http://localhost:3000/api/swagger"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    modifies/apiThis PR adds API routes or modifies themtype/bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions