Skip to content

Commit caf05c9

Browse files
authored
fix(upload): thumbnail is lost (#516)
* fix(upload): thumbnail is not committed correcly on upload/update request * fix(devops): short name for UI pretty on github checks * fix(devops): short name for UI pretty on github checks
1 parent 3e5b77a commit caf05c9

File tree

7 files changed

+12
-140
lines changed

7 files changed

+12
-140
lines changed

.github/workflows/build-&-publish-docker-image.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "Build & Publish Docker Image"
1+
name: "Dockerize"
22

33
concurrency:
44
group: "publish-${{ github.ref }}"

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ on:
1414

1515
jobs:
1616
linter:
17-
name: Buf & Golangci lint
17+
name: Lints
1818
runs-on: [self-hosted,docker-builds]
1919
steps:
2020
- name: Setup go 1.17

code/go/0chain.net/blobbercore/allocation/allocationchange.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ func (cc *AllocationChangeCollector) ComputeProperties() {
119119
var acp AllocationChangeProcessor
120120
switch change.Operation {
121121
case constants.FileOperationInsert:
122-
acp = new(NewFileChange)
122+
acp = new(AddFileChanger)
123123
case constants.FileOperationUpdate:
124124
acp = new(UpdateFileChanger)
125125
case constants.FileOperationDelete:
@@ -130,7 +130,6 @@ func (cc *AllocationChangeCollector) ComputeProperties() {
130130
acp = new(CopyFileChange)
131131
case constants.FileOperationUpdateAttrs:
132132
acp = new(AttributesChange)
133-
134133
}
135134

136135
if acp == nil {

code/go/0chain.net/blobbercore/allocation/file_changer_base.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ type BaseFileChanger struct {
2424
ActualThumbnailSize int64 `json:"actual_thumb_size"`
2525
//client side:
2626
ActualThumbnailHash string `json:"actual_thumb_hash"`
27+
2728
//client side:
2829
MimeType string `json:"mimetype,omitempty"`
2930
//client side:

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,10 @@ func (cmd *AddFileCommand) reloadChange(connectionObj *allocation.AllocationChan
157157
}
158158

159159
cmd.fileChanger.Size = dbChangeProcessor.Size
160+
cmd.fileChanger.ThumbnailFilename = dbChangeProcessor.ThumbnailFilename
161+
cmd.fileChanger.ThumbnailSize = dbChangeProcessor.ThumbnailSize
162+
cmd.fileChanger.ThumbnailHash = dbChangeProcessor.Hash
163+
160164
return
161165
}
162166
}

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

Lines changed: 0 additions & 135 deletions
This file was deleted.

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ func (cmd *UpdateFileCommand) reloadChange(connectionObj *allocation.AllocationC
158158
for _, c := range connectionObj.Changes {
159159
if c.Operation == constants.FileOperationUpdate {
160160

161-
dbFileChanger := &allocation.AddFileChanger{}
161+
dbFileChanger := &allocation.UpdateFileChanger{}
162162

163163
err := dbFileChanger.Unmarshal(c.Input)
164164
if err != nil {
@@ -167,6 +167,9 @@ func (cmd *UpdateFileCommand) reloadChange(connectionObj *allocation.AllocationC
167167

168168
// reload uploaded size from db, it was chunk size from client
169169
cmd.fileChanger.Size = dbFileChanger.Size
170+
cmd.fileChanger.ThumbnailFilename = dbFileChanger.ThumbnailFilename
171+
cmd.fileChanger.ThumbnailSize = dbFileChanger.ThumbnailSize
172+
cmd.fileChanger.ThumbnailHash = dbFileChanger.Hash
170173
return
171174
}
172175
}

0 commit comments

Comments
 (0)