Skip to content

Commit

Permalink
perf: object status judge logic
Browse files Browse the repository at this point in the history
  • Loading branch information
constwz committed Feb 2, 2024
1 parent 4d45be7 commit 4cddc17
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
4 changes: 3 additions & 1 deletion e2e/tests/storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2402,6 +2402,8 @@ func (s *StorageTestSuite) TestDeleteCreateObject_InCreatedStatus() {
s.Require().Equal(queryHeadObjectResponse.ObjectInfo.Creator, "")
// CancelCreateObject
msgDeleteCreateObject := storagetypes.NewMsgDeleteObject(user.GetAddr(), bucketName, objectName)
s.Require().NoError(err)
s.SendTxBlock(user, msgDeleteCreateObject)

_, err = s.Client.HeadObject(ctx, &queryHeadObjectRequest)
s.Require().EqualError(err, "rpc error: code = Unknown desc = No such object: unknown request")
}
5 changes: 0 additions & 5 deletions x/storage/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -890,11 +890,6 @@ func (k Keeper) DeleteObject(
return k.CancelCreateObject(ctx, operator, bucketName, objectName, types.CancelCreateObjectOptions{SourceType: types.SOURCE_TYPE_ORIGIN})
}

if objectInfo.ObjectStatus != types.OBJECT_STATUS_SEALED &&
objectInfo.ObjectStatus != types.OBJECT_STATUS_DISCONTINUED {
return types.ErrObjectNotSealed
}

// check permission
effect := k.VerifyObjectPermission(ctx, bucketInfo, objectInfo, operator, permtypes.ACTION_DELETE_OBJECT)
if effect != permtypes.EFFECT_ALLOW {
Expand Down

0 comments on commit 4cddc17

Please sign in to comment.