From 83e0b55423885ae2a18a829e929266a5212754a4 Mon Sep 17 00:00:00 2001 From: Tordarus Date: Fri, 14 Jan 2022 17:27:33 +0100 Subject: [PATCH] replaced file server with writing files manually --- main.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 6e5ffd5..ed5bda4 100644 --- a/main.go +++ b/main.go @@ -94,7 +94,14 @@ func get(w http.ResponseWriter, r *http.Request) { return } - fileServer.ServeHTTP(w, r) + file, err := os.Open(path) + if err != nil { + handleError(w, r, err) + return + } + defer file.Close() + + io.Copy(w, file) } func put(w http.ResponseWriter, r *http.Request) {