From be2daeb535fc4e0d8ad521947543bfe3abc23486 Mon Sep 17 00:00:00 2001 From: HeshamTB Date: Wed, 20 Sep 2023 16:18:38 +0300 Subject: [PATCH] fix: 404 if path is undefined --- main.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main.go b/main.go index 63b1ca9..42196b3 100644 --- a/main.go +++ b/main.go @@ -275,6 +275,11 @@ func handleDirectDownload(w http.ResponseWriter, r *http.Request) { } func handleRoot(w http.ResponseWriter, r *http.Request) { + if r.URL.Path != "/" && r.URL.Path != "" { + w.WriteHeader(http.StatusNotFound) + return + } + ctx := NewContext(r) formats := []DownloadFormats{} formats = append(formats, DownloadFormats{