refactor HTTP error.

This commit is contained in:
Miroslav Šedivý 2021-09-16 20:16:51 +02:00
parent d46c5d9d30
commit 4fa11e6a2a
15 changed files with 166 additions and 102 deletions

View file

@ -90,7 +90,7 @@ func (h *RoomHandler) uploadMiddleware(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
session := auth.GetSession(r)
if !session.IsHost() && (!session.Profile().CanHost || !h.sessions.ImplicitHosting()) {
utils.HttpForbidden(w, "without implicit hosting, only host can upload files")
utils.HttpForbidden(w).Msg("without implicit hosting, only host can upload files")
} else {
next.ServeHTTP(w, r)
}