From 26042b62acd7f7346f1a99a0ac37b3f2f99e3f75 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Tue, 23 May 2023 20:16:26 -0400 Subject: [PATCH] fix: Use gorm save, and return nil if successful --- tusstore/store.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tusstore/store.go b/tusstore/store.go index d01a0b6..d1200bb 100644 --- a/tusstore/store.go +++ b/tusstore/store.go @@ -231,11 +231,13 @@ func (upload *fileUpload) writeInfo() error { if tusRecord != nil { tusRecord.Info = string(data) - if ret := db.Get().Update("info", &tusRecord); ret.Error != nil { + if ret := db.Get().Save(&tusRecord); ret.Error != nil { logger.Get().Error("failed to update tus entry", zap.Error(ret.Error)) return ret.Error } + + return nil } tusRecord = &model.Tus{UploadID: upload.info.ID, Hash: upload.hash, Info: string(data)}