Skip to content

Commit

Permalink
Return a 404 instead of 500 when clients access media which is frozen
Browse files Browse the repository at this point in the history
  • Loading branch information
turt2live committed Aug 7, 2024
1 parent 85fabea commit 689641e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]

*Nothing yet*
### Fixed

* Return a 404 instead of 500 when clients access media which is frozen.

## [1.3.7] - July 30, 2024

Expand Down
2 changes: 1 addition & 1 deletion api/r0/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func DownloadMedia(r *http.Request, rctx rcontext.RequestContext, auth _apimeta.
return _responses.ErrorResponse{
Code: common.ErrCodeNotFound,
Message: "authentication is required to download this media",
InternalCode: common.ErrCodeUnauthorized,
InternalCode: common.ErrCodeNotFound, // used to determine http status code
}
} else if errors.Is(err, common.ErrMediaTooLarge) {
return _responses.RequestTooLarge()
Expand Down
2 changes: 1 addition & 1 deletion api/r0/thumbnail.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func ThumbnailMedia(r *http.Request, rctx rcontext.RequestContext, auth _apimeta
return _responses.ErrorResponse{
Code: common.ErrCodeNotFound,
Message: "authentication is required to download this media",
InternalCode: common.ErrCodeUnauthorized,
InternalCode: common.ErrCodeNotFound, // used to determine http status code
}
} else if errors.Is(err, common.ErrMediaTooLarge) {
return _responses.RequestTooLarge()
Expand Down

0 comments on commit 689641e

Please sign in to comment.