Skip to content

Commit

Permalink
Merge pull request #1521 from 0chain/hotfix/mob-delete
Browse files Browse the repository at this point in the history
Remove usage of delete file in mob and winsdk
  • Loading branch information
dabasov authored Jun 11, 2024
2 parents 3726075 + 7eba1aa commit e2f3152
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
9 changes: 8 additions & 1 deletion mobilesdk/zbox/allocation.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,14 @@ func (a *Allocation) DeleteFile(remotePath string) error {
if a == nil || a.sdkAllocation == nil {
return ErrInvalidAllocation
}
return a.sdkAllocation.DeleteFile(remotePath)
a.sdkAllocation.SetCheckStatus(true)
defer a.sdkAllocation.SetCheckStatus(false)
return a.sdkAllocation.DoMultiOperation([]sdk.OperationRequest{
{
OperationType: constants.FileOperationDelete,
RemotePath: remotePath,
},
})
}

// RenameObject - rename or move file
Expand Down
9 changes: 8 additions & 1 deletion mobilesdk/zbox/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,14 @@ func DeleteFile(allocationID, remotePath string) error {
if err != nil {
return err
}
return a.DeleteFile(remotePath)
a.SetCheckStatus(true)
defer a.SetCheckStatus(false)
return a.DoMultiOperation([]sdk.OperationRequest{
{
OperationType: constants.FileOperationDelete,
RemotePath: remotePath,
},
})
}

// RenameObject - rename or move file
Expand Down
7 changes: 6 additions & 1 deletion winsdk/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,12 @@ func Delete(allocationID, path *C.char) *C.char {

s := C.GoString(path)

err = alloc.DeleteFile(s)
err = alloc.DoMultiOperation([]sdk.OperationRequest{
{
OperationType: "delete",
RemotePath: s,
},
})

if err != nil {
return WithJSON(false, err)
Expand Down

0 comments on commit e2f3152

Please sign in to comment.