From 4511029dde8ee997be49c1f6d2f736a1aa2fd97a Mon Sep 17 00:00:00 2001 From: James Mills Date: Sun, 22 Mar 2020 19:09:14 +1000 Subject: [PATCH] Re-add direct library add --- app/app.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/app.go b/app/app.go index d315abc..72455b7 100644 --- a/app/app.go +++ b/app/app.go @@ -234,6 +234,13 @@ func (a *App) uploadHandler(w http.ResponseWriter, r *http.Request) { return } + if err := a.Library.Add(of); err != nil { + err := fmt.Errorf("error adding new video: %w", err) + log.Error(err) + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + fmt.Fprintf(w, "Video successfully uploaded!") } else { http.Error(w, "Method Not Allowed", http.StatusMethodNotAllowed)