(ctx context.Context, bucketName, objectName string, reader io.Reader, size int64, opts PutObjectOptions, )
| 37 | ) |
| 38 | |
| 39 | func (c *Client) putObjectMultipart(ctx context.Context, bucketName, objectName string, reader io.Reader, size int64, |
| 40 | opts PutObjectOptions, |
| 41 | ) (info UploadInfo, err error) { |
| 42 | info, err = c.putObjectMultipartNoStream(ctx, bucketName, objectName, reader, opts) |
| 43 | if err != nil { |
| 44 | errResp := ToErrorResponse(err) |
| 45 | // Verify if multipart functionality is not available, if not |
| 46 | // fall back to single PutObject operation. |
| 47 | if errResp.Code == AccessDenied && strings.Contains(errResp.Message, "Access Denied") { |
| 48 | // Verify if size of reader is greater than '5GiB'. |
| 49 | if size > maxSinglePutObjectSize { |
| 50 | return UploadInfo{}, errEntityTooLarge(size, maxSinglePutObjectSize, bucketName, objectName) |
| 51 | } |
| 52 | // Fall back to uploading as single PutObject operation. |
| 53 | return c.putObject(ctx, bucketName, objectName, reader, size, opts) |
| 54 | } |
| 55 | } |
| 56 | return info, err |
| 57 | } |
| 58 | |
| 59 | func (c *Client) putObjectMultipartNoStream(ctx context.Context, bucketName, objectName string, reader io.Reader, opts PutObjectOptions) (info UploadInfo, err error) { |
| 60 | // Input validation. |
no test coverage detected