-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: remove create object & bucket approval #225
Changes from all commits
6e08609
7cb2c86
fd9a23c
a4f5966
16cb540
7b6c1c0
fb653d4
dc98349
8068347
191a9ab
24c5e95
29a4932
06dde86
4ce7454
7cc0777
08d95d6
99a44ad
31c3420
2679dcb
c8e9704
923837b
d21756b
7d74a14
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -120,6 +120,10 @@ func (c *Client) CreateObject(ctx context.Context, bucketName, objectName string | |
return "", err | ||
} | ||
|
||
if !utils.CheckObjectName(objectName) { | ||
return "", fmt.Errorf("fail to check object name:%s", objectName) | ||
} | ||
|
||
// compute hash root of payload | ||
expectCheckSums, size, redundancyType, err := c.ComputeHashRoots(reader, opts.IsSerialComputeMode) | ||
if err != nil { | ||
|
@@ -148,17 +152,12 @@ func (c *Client) CreateObject(ctx context.Context, bucketName, objectName string | |
return "", err | ||
} | ||
|
||
signedCreateObjectMsg, err := c.GetCreateObjectApproval(ctx, createObjectMsg) | ||
if err != nil { | ||
return "", err | ||
} | ||
|
||
// set the default txn broadcast mode as block mode | ||
if opts.TxOpts == nil { | ||
broadcastMode := tx.BroadcastMode_BROADCAST_MODE_SYNC | ||
opts.TxOpts = &gnfdsdk.TxOption{Mode: &broadcastMode} | ||
} | ||
msgs := []sdk.Msg{signedCreateObjectMsg} | ||
msgs := []sdk.Msg{createObjectMsg} | ||
|
||
if opts.Tags != nil { | ||
// Set tag | ||
|
@@ -1116,7 +1115,7 @@ func (c *Client) ListObjects(ctx context.Context, bucketName string, opts types. | |
return listObjectsResult, nil | ||
} | ||
|
||
// GetCreateObjectApproval returns the signature info for the approval of preCreating resources | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. // Deprecated: GetCreateObjectApproval returns the signature info for the approval of preCreating resources No need to delete this API There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean change the comment to other than delete this line: // Deprecated: GetCreateObjectApproval returns the signature info for the approval of preCreating resources There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And the same to GetCreateBucketApproval API There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed |
||
// Deprecated: GetCreateObjectApproval returns the signature info for the approval of preCreating resources | ||
func (c *Client) GetCreateObjectApproval(ctx context.Context, createObjectMsg *storageTypes.MsgCreateObject) (*storageTypes.MsgCreateObject, error) { | ||
unsignedBytes := createObjectMsg.GetSignBytes() | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you wrap these format check codes into a single function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also move the object name rules into the CheckObjectName function, not comment here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CheckObjectName already has the same comments, so i just delete it