From 023fdab96fc8cca500e48030bc73943d9edcc825 Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Fri, 1 Jul 2022 03:31:08 +0400 Subject: [PATCH] Added special case for curl in NotFound handler. --- internal/handlers/handlers.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/handlers/handlers.go b/internal/handlers/handlers.go index 05f81e1..e3b9c9e 100644 --- a/internal/handlers/handlers.go +++ b/internal/handlers/handlers.go @@ -182,5 +182,9 @@ func (h *UploadHandlers) Download(w http.ResponseWriter, r *http.Request) { func (h *UploadHandlers) NotFound(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusNotFound) + if !strings.Contains(r.UserAgent(), "curl") { web.Error404(utils.MainSite(r.Host), w) + } else { + fmt.Fprintln(w, "deleted") + } }