From 458cf850d2cbc21b75d97b173d4afbd86bb00b24 Mon Sep 17 00:00:00 2001 From: Tordarus Date: Fri, 14 Jan 2022 17:41:45 +0100 Subject: [PATCH] fixed file path --- main.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/main.go b/main.go index ed5bda4..789d3b2 100644 --- a/main.go +++ b/main.go @@ -94,14 +94,8 @@ func get(w http.ResponseWriter, r *http.Request) { return } - file, err := os.Open(path) - if err != nil { - handleError(w, r, err) - return - } - defer file.Close() - - io.Copy(w, file) + r.URL.Path = path + fileServer.ServeHTTP(w, r) } func put(w http.ResponseWriter, r *http.Request) {