Skip to content
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

PUT on /notifications endpoint with invalid date causes internal server error #15346

Closed
2 of 6 tasks
matusf opened this issue Apr 8, 2021 · 3 comments
Closed
2 of 6 tasks
Labels
modifies/api This PR adds API routes or modifies them type/bug

Comments

@matusf
Copy link

matusf commented Apr 8, 2021

  • 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/08 18:14:24 Completed PUT /api/v1/notifications?last_read_at=xxx 500 Internal Server Error in 35.807758ms

Description

Make PUT request on /notifications endpoint with supplied authorization token and invalid date in query parameters. Then 500 response is returned with following response body:

curl -X PUT 'http://localhost:3000/api/v1/notifications?last_read_at=xxx' -H "Authorization: token $TOKEN"
{"message":"","url":"http://localhost:3000/api/swagger"}
@6543 6543 added the modifies/api This PR adds API routes or modifies them label Apr 9, 2021
@6543
Copy link
Member

6543 commented Apr 9, 2021

I think we should return a 400 with an error description

@zeripath
Copy link
Contributor

I mean a 500 here is not entirely inappropriate, from MDN:

500 Internal Server Error
The server has encountered a situation it doesn't know how to handle.

I think 422 is really supposed to be emitted by WebDAV servers - I'm not sure how many other services use it.

400: Bad Request is probably the better supported option.

@noerw noerw added the type/bug label May 20, 2021
@6543
Copy link
Member

6543 commented Jun 17, 2021

shuld be solve by #16177

@6543 6543 closed this as completed Jun 17, 2021
@go-gitea go-gitea locked and limited conversation to collaborators Oct 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
modifies/api This PR adds API routes or modifies them type/bug
Projects
None yet
Development

No branches or pull requests

4 participants