From 00d2f3e5109247b14e2434c54aa9db0b92a26219 Mon Sep 17 00:00:00 2001 From: jabuxas Date: Tue, 15 Oct 2024 18:27:24 -0300 Subject: [PATCH] refactor: remove redundant uploadHandler --- handlers.go | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/handlers.go b/handlers.go index 487533f..56ff74e 100644 --- a/handlers.go +++ b/handlers.go @@ -75,7 +75,7 @@ func (app *Application) fileListingHandler(w http.ResponseWriter, r *http.Reques func (app *Application) indexHandler(w http.ResponseWriter, r *http.Request) { if r.Method == http.MethodPost { - app.parserHandler(w, r) + app.uploadHandler(w, r) return } @@ -135,13 +135,6 @@ func (app *Application) lastUploadedHandler(w http.ResponseWriter, r *http.Reque } 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 { http.Error(w, "Error creating storage directory", http.StatusInternalServerError)