From dab675474aaceddf3b21dd6e2f42c1d6227caf4a Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Thu, 25 May 2023 00:47:32 +0400 Subject: [PATCH] Set default NotFound handler. --- cmd/dwelling-upload/main.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/dwelling-upload/main.go b/cmd/dwelling-upload/main.go index 239417a..f6938b2 100644 --- a/cmd/dwelling-upload/main.go +++ b/cmd/dwelling-upload/main.go @@ -8,6 +8,7 @@ import ( "flag" "fmt" "log" + nethttp "net/http" "net/netip" "os" "os/signal" @@ -88,7 +89,9 @@ func main() { *keepFileForHours, *limitStorage, *limitFileSize) srv := http.NewHttpServer() - srv.SetNotFoundHandler(http.NotFound) + srv.SetNotFoundHandler(func(w nethttp.ResponseWriter, r *nethttp.Request) { + http.Error(w, r, nethttp.StatusNotFound, "") + }) srv.ServeStatic("/assets/*filepath", hand.AssetsFS()) srv.GET("/robots.txt", http.RobotsTxt)