Skip to content

Commit

Permalink
check delete behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
jojoliang committed Apr 21, 2022
1 parent a7a4eb6 commit 07068b5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion object.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ type ObjectDeleteOptions struct {
func (s *ObjectService) Delete(ctx context.Context, name string, opt ...*ObjectDeleteOptions) (*Response, error) {
var optHeader *ObjectDeleteOptions
// When use "" string might call the delete bucket interface
if len(name) == 0 {
if len(name) == 0 || name == "/" {
return nil, errors.New("empty object name")
}
if len(opt) > 0 {
Expand Down Expand Up @@ -1457,6 +1457,9 @@ func (s *ObjectService) GetTagging(ctx context.Context, name string, id ...strin
}

func (s *ObjectService) DeleteTagging(ctx context.Context, name string, id ...string) (*Response, error) {
if len(name) == 0 || name == "/" {
return nil, errors.New("empty object name")
}
var u string
if len(id) == 1 {
u = fmt.Sprintf("/%s?tagging&versionId=%s", encodeURIComponent(name), id[0])
Expand Down
3 changes: 3 additions & 0 deletions object_part.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,9 @@ func (s *ObjectService) CompleteMultipartUpload(ctx context.Context, name, uploa
//
// https://www.qcloud.com/document/product/436/7740
func (s *ObjectService) AbortMultipartUpload(ctx context.Context, name, uploadID string) (*Response, error) {
if len(name) == 0 || name == "/" {
return nil, errors.New("empty object name")
}
u := fmt.Sprintf("/%s?uploadId=%s", encodeURIComponent(name), uploadID)
sendOpt := sendOptions{
baseURL: s.client.BaseURL.BucketURL,
Expand Down

0 comments on commit 07068b5

Please sign in to comment.