Loading registry/storage/driver/s3-aws/v2/s3.go +13 −1 Original line number Diff line number Diff line Loading @@ -568,6 +568,8 @@ func (d *driver) Writer(ctx context.Context, path string, appendParam bool) (sto return d.newWriter(key, *mpUpload.UploadId, allParts), nil } var errUnusableHeadObjectResponse = errors.New("HeadObject returned unusable response") func (d *driver) statHead(ctx context.Context, path string) (*storagedriver.FileInfoFields, error) { // NOTE(prozlach): This is to cover for the cases when the rootDirectory of // the driver is either "" or "/". Loading @@ -586,6 +588,13 @@ func (d *driver) statHead(ctx context.Context, path string) (*storagedriver.File if err != nil { return nil, err } // Some S3 implementations return an empty response for certain keys. // The sentinal error signals the caller to retry with a ListBucket. if resp.ContentLength == nil && resp.LastModified == nil { return nil, errUnusableHeadObjectResponse } return &storagedriver.FileInfoFields{ Path: path, IsDir: false, Loading Loading @@ -693,7 +702,10 @@ func (d *driver) Stat(ctx context.Context, path string) (storagedriver.FileInfo, // error if querying a key which doesn't exist or a key which has // nested keys and Forbidden if IAM/ACL permissions do not allow Head // but allow List. if errors.As(err, new(smithy.APIError)) { // // If the response is unusable (due to bugs in alternative S3 // implementations), we also fail over to ListObjects. if errors.As(err, new(smithy.APIError)) || errors.Is(err, errUnusableHeadObjectResponse) { fi, err := d.statList(ctx, path) if err != nil { return nil, parseError(path, err) Loading Loading
registry/storage/driver/s3-aws/v2/s3.go +13 −1 Original line number Diff line number Diff line Loading @@ -568,6 +568,8 @@ func (d *driver) Writer(ctx context.Context, path string, appendParam bool) (sto return d.newWriter(key, *mpUpload.UploadId, allParts), nil } var errUnusableHeadObjectResponse = errors.New("HeadObject returned unusable response") func (d *driver) statHead(ctx context.Context, path string) (*storagedriver.FileInfoFields, error) { // NOTE(prozlach): This is to cover for the cases when the rootDirectory of // the driver is either "" or "/". Loading @@ -586,6 +588,13 @@ func (d *driver) statHead(ctx context.Context, path string) (*storagedriver.File if err != nil { return nil, err } // Some S3 implementations return an empty response for certain keys. // The sentinal error signals the caller to retry with a ListBucket. if resp.ContentLength == nil && resp.LastModified == nil { return nil, errUnusableHeadObjectResponse } return &storagedriver.FileInfoFields{ Path: path, IsDir: false, Loading Loading @@ -693,7 +702,10 @@ func (d *driver) Stat(ctx context.Context, path string) (storagedriver.FileInfo, // error if querying a key which doesn't exist or a key which has // nested keys and Forbidden if IAM/ACL permissions do not allow Head // but allow List. if errors.As(err, new(smithy.APIError)) { // // If the response is unusable (due to bugs in alternative S3 // implementations), we also fail over to ListObjects. if errors.As(err, new(smithy.APIError)) || errors.Is(err, errUnusableHeadObjectResponse) { fi, err := d.statList(ctx, path) if err != nil { return nil, parseError(path, err) Loading