From 8f9eb13f69a46cec513a0fb0761a82f7d80653ea Mon Sep 17 00:00:00 2001 From: Robert Swain Date: Tue, 9 May 2017 20:10:59 +0200 Subject: [PATCH] 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. --- src/github.com/matrix-org/dendrite/mediaapi/writers/upload.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/github.com/matrix-org/dendrite/mediaapi/writers/upload.go b/src/github.com/matrix-org/dendrite/mediaapi/writers/upload.go index 363722e8a..4b6fb152c 100644 --- a/src/github.com/matrix-org/dendrite/mediaapi/writers/upload.go +++ b/src/github.com/matrix-org/dendrite/mediaapi/writers/upload.go @@ -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 {