From 113120aa32fb6eac38d396fee1ee9fc60006d8ac Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Tue, 12 Oct 2021 18:51:01 +0200 Subject: [mpaste] Bug fixes --- mpaste.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mpaste.go b/mpaste.go index eec6a20..ade4b8e 100644 --- a/mpaste.go +++ b/mpaste.go @@ -178,6 +178,7 @@ func endpoint(w http.ResponseWriter, r *http.Request) { } mutex.Lock() + defer mutex.Unlock() fname := file_prefix + strconv.Itoa(counter) nfile, err := os.Create(fname) @@ -198,7 +199,6 @@ func endpoint(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, domain+"/%d\n", counter) counter++ - mutex.Unlock() default: WRITE_HEADER(http.StatusMethodNotAllowed, "Only GET and POST requests are supported") } @@ -233,6 +233,10 @@ func main() { file_prefix += "/" } + if counter_file == "" { + counter_file = "counter" + } + if index_file == "" { index_file = "index.html" } -- cgit v1.2.3