diff --git a/abyss.go b/abyss.go index b968ca9..3a349de 100644 --- a/abyss.go +++ b/abyss.go @@ -68,10 +68,10 @@ func main() { ) mux.HandleFunc("/last", app.lastUploadedHandler) if auth == "yes" { - mux.HandleFunc("/upload", app.basicAuth(app.uploadHandler)) + mux.HandleFunc("/upload", app.basicAuth(app.parserHandler)) slog.Warn("text uploading through the browser will be restricted") } else { - mux.HandleFunc("/upload", app.uploadHandler) + mux.HandleFunc("/upload", app.parserHandler) slog.Warn("text uploading through the browser will NOT be restricted") } diff --git a/handlers.go b/handlers.go index 487533f..80dd328 100644 --- a/handlers.go +++ b/handlers.go @@ -134,13 +134,6 @@ func (app *Application) lastUploadedHandler(w http.ResponseWriter, r *http.Reque http.ServeFile(w, r, app.lastUploadedFile) } -func (app *Application) uploadHandler(w http.ResponseWriter, r *http.Request) { - if r.Method == http.MethodPost { - app.parserHandler(w, r) - return - } -} - func (app *Application) parserHandler(w http.ResponseWriter, r *http.Request) { if _, err := os.Stat(app.filesDir); err != nil { if err := os.Mkdir(app.filesDir, 0750); err != nil {