RemoveIncompleteUpload aborts an partially uploaded object.
(ctx context.Context, bucketName, objectName string)
| 719 | |
| 720 | // RemoveIncompleteUpload aborts an partially uploaded object. |
| 721 | func (c *Client) RemoveIncompleteUpload(ctx context.Context, bucketName, objectName string) error { |
| 722 | // Input validation. |
| 723 | if err := s3utils.CheckValidBucketName(bucketName); err != nil { |
| 724 | return err |
| 725 | } |
| 726 | if err := s3utils.CheckValidObjectName(objectName); err != nil { |
| 727 | return err |
| 728 | } |
| 729 | // Find multipart upload ids of the object to be aborted. |
| 730 | uploadIDs, err := c.findUploadIDs(ctx, bucketName, objectName) |
| 731 | if err != nil { |
| 732 | return err |
| 733 | } |
| 734 | |
| 735 | for _, uploadID := range uploadIDs { |
| 736 | // abort incomplete multipart upload, based on the upload id passed. |
| 737 | err := c.abortMultipartUpload(ctx, bucketName, objectName, uploadID) |
| 738 | if err != nil { |
| 739 | return err |
| 740 | } |
| 741 | } |
| 742 | |
| 743 | return nil |
| 744 | } |
| 745 | |
| 746 | // abortMultipartUpload aborts a multipart upload for the given |
| 747 | // uploadID, all previously uploaded parts are deleted. |
no test coverage detected