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

GetReleaseAttachment API returns 500 when the ID is not found #20884

Closed
earl-warren opened this issue Aug 21, 2022 · 0 comments · Fixed by #20886
Closed

GetReleaseAttachment API returns 500 when the ID is not found #20884

earl-warren opened this issue Aug 21, 2022 · 0 comments · Fixed by #20886
Labels
Milestone

Comments

@earl-warren
Copy link
Contributor

Description

See here:

	attach, err := repo_model.GetAttachmentByID(ctx, attachID)
	if err != nil {
		ctx.Error(http.StatusInternalServerError, "GetAttachmentByID", err)
		return
	}

It should return 404 when attachID is not found instead.

Gitea Version

dev

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

a

Screenshots

a

Git Version

a

Operating System

a

How are you running Gitea?

a

Database

SQLite

zeripath added a commit to zeripath/gitea that referenced this issue Aug 21, 2022
Add code to test if GetAttachmentByID returns an ErrAttachmentNotExist error
and return NotFound instead of InternalServerError

Fix go-gitea#20884

Signed-off-by: Andrew Thornton <art27@cantab.net>
@lunny lunny added this to the 1.17.2 milestone Aug 22, 2022
zeripath added a commit that referenced this issue Aug 24, 2022
Add code to test if GetAttachmentByID returns an ErrAttachmentNotExist error
and return NotFound instead of InternalServerError

Fix #20884

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
zeripath added a commit to zeripath/gitea that referenced this issue Aug 24, 2022
…20886)

Backport go-gitea#20886

Add code to test if GetAttachmentByID returns an ErrAttachmentNotExist error
and return NotFound instead of InternalServerError

Fix go-gitea#20884

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
lunny added a commit that referenced this issue Aug 25, 2022
…20941)

Backport #20886

Add code to test if GetAttachmentByID returns an ErrAttachmentNotExist error
and return NotFound instead of InternalServerError

Fix #20884

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
vsysoev pushed a commit to IntegraSDL/gitea that referenced this issue Aug 28, 2022
…20886)

Add code to test if GetAttachmentByID returns an ErrAttachmentNotExist error
and return NotFound instead of InternalServerError

Fix go-gitea#20884

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants