Skip to content

Commit 40eda48

Browse files
committed
use base path rather than name from client
1 parent 6dd2cf2 commit 40eda48

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,6 @@ func (cc *AllocationChangeCollector) ApplyChanges(ctx context.Context, allocatio
231231
if err != nil {
232232
return rootRef, err
233233
}
234-
logging.Logger.Info("ApplyChanges", zap.String("allocation_id", cc.AllocationID), zap.Any("root_ref", *rootRef))
235234
err = collector.Finalize(ctx)
236235
return rootRef, err
237236
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ func (nf *UploadFileChanger) applyChange(ctx context.Context, rootRef *reference
102102
ValidationRootSignature: nf.ValidationRootSignature,
103103
CustomMeta: nf.CustomMeta,
104104
FixedMerkleRoot: nf.FixedMerkleRoot,
105-
Name: nf.Filename,
105+
Name: filepath.Base(nf.Path),
106106
Path: nf.Path,
107107
ParentPath: dirRef.Path,
108108
Type: reference.FILE,

code/go/0chain.net/blobbercore/reference/object.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import (
66

77
"github.com/0chain/blobber/code/go/0chain.net/blobbercore/datastore"
88
"github.com/0chain/blobber/code/go/0chain.net/core/common"
9-
"github.com/0chain/blobber/code/go/0chain.net/core/logging"
10-
"go.uber.org/zap"
119
)
1210

1311
func DeleteObject(ctx context.Context, rootRef *Ref, allocationID, objPath string, ts common.Timestamp) error {
@@ -37,7 +35,6 @@ func DeleteObject(ctx context.Context, rootRef *Ref, allocationID, objPath strin
3735
return nil
3836
}
3937
parentPath, deleteFileName := filepath.Split(objPath)
40-
logging.Logger.Info("delete_object", zap.String("parent_path", parentPath), zap.String("delete_file_name", deleteFileName))
4138
rootRef.UpdatedAt = ts
4239
fields, err := common.GetPathFields(parentPath)
4340
if err != nil {
@@ -63,9 +60,10 @@ func DeleteObject(ctx context.Context, rootRef *Ref, allocationID, objPath strin
6360
return common.NewError("invalid_reference_path", "Reference path has invalid references")
6461
}
6562
}
66-
logging.Logger.Info("delete_object", zap.Any("dir_ref", dirRef))
63+
6764
for i, child := range dirRef.Children {
68-
if child.Name == deleteFileName {
65+
basePath := filepath.Base(child.Path)
66+
if basePath == deleteFileName {
6967
dirRef.RemoveChild(i)
7068
break
7169
}

0 commit comments

Comments
 (0)