Remove direct library add after upload as Rename(s) are not atomic on some file systems

This commit is contained in:
James Mills 2020-03-22 18:31:24 +10:00
parent e2381cc2ab
commit a7e88fbcac
No known key found for this signature in database
GPG key ID: AC4C014F1440EBD6

View file

@ -240,13 +240,6 @@ func (a *App) uploadHandler(w http.ResponseWriter, r *http.Request) {
os.Rename(tf.Name(), of)
os.Remove(fn)
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)