don't cause internal server errors for static file requests for invalid paths

eg containing %00. just treat those as "file not found", because invalid
paths can't exist.

based on error logging i encountered some time ago.
This commit is contained in:
Mechiel Lukkien
2025-09-29 11:49:17 +02:00
parent 02f1e2c9db
commit 514abe81f0
+1 -1
View File
@@ -207,7 +207,7 @@ func HandleStatic(h *config.WebStatic, compress bool, w http.ResponseWriter, r *
f, err := os.Open(fspath)
if err != nil {
if os.IsNotExist(err) || errors.Is(err, syscall.ENOTDIR) {
if os.IsNotExist(err) || errors.Is(err, syscall.ENOTDIR) || errors.Is(err, syscall.EINVAL) {
if h.ContinueNotFound {
// We haven't handled this request, try a next WebHandler in the list.
return false