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

Closed
opened 2025-11-02 08:38:47 -06:00 by GiteaMirror · 0 comments
Owner

Originally created by @earl-warren on GitHub (Aug 21, 2022).

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

Originally created by @earl-warren on GitHub (Aug 21, 2022). ### Description See [here](https://github.com/go-gitea/gitea/blob/6784a707d101ef31a9ef3a46468c28e1d9700ac8/routers/api/v1/repo/release_attachment.go#L58-L62): ``` 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
GiteaMirror added the type/bug label 2025-11-02 08:38:47 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#9437