Re-add direct library add

This commit is contained in:
James Mills 2020-03-22 19:09:14 +10:00
parent 2dced8e3ce
commit 4511029dde
No known key found for this signature in database
GPG key ID: AC4C014F1440EBD6

View file

@ -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)