Skip to content

Commit 1445a37

Browse files
authored
Merge pull request #1422 from 0chain/fix/delete-object
Fix delete object
2 parents feda209 + 40eda48 commit 1445a37

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ func DeleteObject(ctx context.Context, rootRef *Ref, allocationID, objPath strin
3535
return nil
3636
}
3737
parentPath, deleteFileName := filepath.Split(objPath)
38-
3938
rootRef.UpdatedAt = ts
4039
fields, err := common.GetPathFields(parentPath)
4140
if err != nil {
@@ -63,7 +62,8 @@ func DeleteObject(ctx context.Context, rootRef *Ref, allocationID, objPath strin
6362
}
6463

6564
for i, child := range dirRef.Children {
66-
if child.Name == deleteFileName {
65+
basePath := filepath.Base(child.Path)
66+
if basePath == deleteFileName {
6767
dirRef.RemoveChild(i)
6868
break
6969
}

0 commit comments

Comments
 (0)