Skip to content

Take control over your live stream video by running it yourself. Streaming + chat out of the box.

fix(api): fix for incorrect error handling of favicon uploads

Gabe Kangas8ee6bf723dac
diff --git a/webserver/handlers/admin/config.go b/webserver/handlers/admin/config.go
index ba1bb2ba8e..056199349d 100644
--- a/webserver/handlers/admin/config.go
+++ b/webserver/handlers/admin/config.go
@@ -2,6 +2,7 @@ package admin
import (
"encoding/json"
+ "errors"
"fmt"
"io"
"net"
@@ -292,7 +293,12 @@ func SetFavicon(w http.ResponseWriter, r *http.Request) {
// Limit request body and parse multipart form with 200KB max
r.Body = http.MaxBytesReader(w, r.Body, 200<<10)
if err := r.ParseMultipartForm(200 << 10); err != nil {
- webutils.WriteSimpleResponse(w, false, "no file provided")
+ var maxBytesErr *http.MaxBytesError
+ if errors.As(err, &maxBytesErr) {
+ webutils.WriteSimpleResponse(w, false, "file too large, max 200KB")
+ } else {
+ webutils.WriteSimpleResponse(w, false, "no file provided")
+ }
return
}