mediaapi/writers/upload: Do not overwrite fields from database

If the entry does not exist, this would set all but the origin and id to
nil.
This commit is contained in:
Robert Swain 2017-05-09 20:10:59 +02:00
parent 911b5dc170
commit 8f9eb13f69

View file

@ -195,7 +195,7 @@ func Upload(req *http.Request, cfg config.MediaAPI, db *storage.Database) util.J
}).Info("File uploaded")
// check if we already have a record of the media in our database and if so, we can remove the temporary directory
err = db.GetMediaMetadata(r.MediaMetadata.MediaID, r.MediaMetadata.Origin, r.MediaMetadata)
err = db.GetMediaMetadata(r.MediaMetadata.MediaID, r.MediaMetadata.Origin, &types.MediaMetadata{})
if err == nil {
tmpDirErr := os.RemoveAll(string(tmpDir))
if tmpDirErr != nil {