mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-08 07:23:10 -06:00
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:
parent
911b5dc170
commit
8f9eb13f69
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue