fix: we need to pin the file after creating the upload

This commit is contained in:
Derrick Hammer 2024-01-22 19:08:56 -05:00
parent 8df2ee9ee8
commit fb1112f3a2
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 7 additions and 1 deletions

View File

@ -564,12 +564,18 @@ func (s *StorageServiceImpl) buildNewTusUploadTask(upload *models.TusUpload) (jo
return err return err
} }
_, err = s.CreateUpload(dbHash, upload.UploaderID, upload.UploaderIP, uint64(byteCount), upload.Protocol) newUpload, err := s.CreateUpload(dbHash, upload.UploaderID, upload.UploaderIP, uint64(byteCount), upload.Protocol)
if err != nil { if err != nil {
s.portal.Logger().Error("Could not create upload", zap.Error(err)) s.portal.Logger().Error("Could not create upload", zap.Error(err))
return err return err
} }
err = s.portal.Accounts().PinByID(newUpload.ID, upload.UploaderID)
if err != nil {
s.portal.Logger().Error("Could not pin upload", zap.Error(err))
return err
}
return nil return nil
}, upload) }, upload)