Skip to content

Commit 92a4b4e

Browse files
committed
fix save file changer
1 parent 56c35cd commit 92a4b4e

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

code/go/0chain.net/blobbercore/handler/file_command_update.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,11 @@ func (cmd *UpdateFileCommand) ProcessContent(allocationObj *allocation.Allocatio
169169
allocation.UpdateConnectionObjSize(connID, cmd.fileChanger.Size)
170170
result.UpdateChange = false
171171
}
172-
173-
err = allocation.SaveFileChanger(connID, &cmd.fileChanger.BaseFileChanger)
174-
if err != nil {
175-
return result, err
172+
if cmd.thumbHeader != nil {
173+
err = allocation.SaveFileChanger(connID, &cmd.fileChanger.BaseFileChanger)
174+
if err != nil {
175+
return result, err
176+
}
176177
}
177178

178179
if allocationObj.BlobberSizeUsed+(allocationSize-cmd.existingFileRef.Size) > allocationObj.BlobberSize {
@@ -202,7 +203,7 @@ func (cmd *UpdateFileCommand) ProcessThumbnail(allocationObj *allocation.Allocat
202203

203204
func (cmd *UpdateFileCommand) reloadChange() {
204205
changer := allocation.GetFileChanger(cmd.fileChanger.ConnectionID, cmd.fileChanger.PathHash)
205-
if changer != nil {
206+
if changer != nil && cmd.fileChanger.ThumbnailHash != "" {
206207
cmd.fileChanger.ThumbnailFilename = changer.ThumbnailFilename
207208
cmd.fileChanger.ThumbnailSize = changer.ThumbnailSize
208209
cmd.fileChanger.ThumbnailHash = changer.ThumbnailHash

code/go/0chain.net/blobbercore/handler/file_command_upload.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,11 @@ func (cmd *UploadFileCommand) ProcessContent(allocationObj *allocation.Allocatio
185185
allocation.UpdateConnectionObjSize(connectionID, cmd.fileChanger.Size)
186186
result.UpdateChange = false
187187
}
188-
189-
err = allocation.SaveFileChanger(connectionID, &cmd.fileChanger.BaseFileChanger)
190-
if err != nil {
191-
return result, err
188+
if cmd.thumbHeader != nil {
189+
err = allocation.SaveFileChanger(connectionID, &cmd.fileChanger.BaseFileChanger)
190+
if err != nil {
191+
return result, err
192+
}
192193
}
193194

194195
if allocationObj.BlobberSizeUsed+allocationSize > allocationObj.BlobberSize {
@@ -219,7 +220,7 @@ func (cmd *UploadFileCommand) ProcessThumbnail(allocationObj *allocation.Allocat
219220

220221
func (cmd *UploadFileCommand) reloadChange() {
221222
changer := allocation.GetFileChanger(cmd.fileChanger.ConnectionID, cmd.fileChanger.PathHash)
222-
if changer != nil {
223+
if changer != nil && changer.ThumbnailHash != "" {
223224
cmd.fileChanger.ThumbnailFilename = changer.ThumbnailFilename
224225
cmd.fileChanger.ThumbnailSize = changer.ThumbnailSize
225226
cmd.fileChanger.ThumbnailHash = changer.ThumbnailHash

0 commit comments

Comments
 (0)