]> source.dussan.org Git - gitea.git/commit
Catch and handle unallowed file type errors in issue attachment API (#30791) (#30834)
authorGiteabot <teabot@gitea.io>
Thu, 2 May 2024 17:45:45 +0000 (01:45 +0800)
committerGitHub <noreply@github.com>
Thu, 2 May 2024 17:45:45 +0000 (01:45 +0800)
commit665a06c41f39427e496fe3ecbb9d4bc59b2325c4
tree97f217eeb1ffdc2af67c2def02e53139bd3142f1
parentf62f04c6bfb418ba324669a0507de0b254afc0e3
Catch and handle unallowed file type errors in issue attachment API (#30791) (#30834)

Backport #30791 by kemzeb

Before, we would just throw 500 if a user passes an attachment that is
not an allowed type. This commit catches this error and throws a 422
instead since this should be considered a validation error.

Co-authored-by: Kemal Zebari <60799661+kemzeb@users.noreply.github.com>
routers/api/v1/repo/issue_attachment.go
routers/api/v1/repo/issue_comment_attachment.go
templates/swagger/v1_json.tmpl
tests/integration/api_comment_attachment_test.go
tests/integration/api_issue_attachment_test.go