Map HTTP 403 error correctly.

Signed-off-by: Christian Richter <crichter@owncloud.com>
Co-authored-by: Julian Koberg <jkoberg@owncloud.com>
This commit is contained in:
Christian Richter
2024-05-29 11:59:43 +02:00
parent d200dfc03f
commit 288203b785

View File

@@ -354,6 +354,8 @@ func (g Webdav) Thumbnail(w http.ResponseWriter, r *http.Request) {
return
case http.StatusBadRequest:
renderError(w, r, errBadRequest(e.Detail))
case http.StatusForbidden:
renderError(w, r, errPermissionDenied(e.Detail))
default:
renderError(w, r, errInternalError(err.Error()))
}
@@ -531,6 +533,10 @@ func errBadRequest(msg string) *errResponse {
return newErrResponse(http.StatusBadRequest, msg)
}
func errPermissionDenied(msg string) *errResponse {
return newErrResponse(http.StatusForbidden, msg)
}
func errNotFound(msg string) *errResponse {
return newErrResponse(http.StatusNotFound, msg)
}