Skip to content

S3's GetObjectResponse.contentRange() returns null with range request #1209

Closed
@flexfrank

Description

@flexfrank

Expected Behavior

If S3Client.getObject() with range is called, GetObjectRequest.contentRange() should return value of Content-Range header (e.g. "bytes 100-200/1000").

Current Behavior

GetObjectRequest.contentRange() always returns null.

Possible Solution

'x-amz-content-range' header contains the desired value.
Populate contentRange field by 'x-amz-content-range' header instead of 'Content-Range' header.

Steps to Reproduce (for bugs)

        String bucketName = "specify your bucket";
        String key = "specify your object's key";
        GetObjectRequest getObjectRequest = GetObjectRequest.builder()
                .bucket(bucketName)
                .key(key)
                .range("bytes=2-3")
                .build();
        GetObjectResponse response = s3Client.getObject(getObjectRequest).response();
        assertNotNull(response.contentRange()); // -> fails

Your Environment

  • AWS Java SDK version used: 2.5.25
  • JDK version used: java version "1.8.0_191"
  • Operating System and version: macOS 10.14.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    investigatingThis issue is being investigated and/or work is in progress to resolve the issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions