Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: adobe/S3Mock
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2.13.1
Choose a base ref
...
head repository: adobe/S3Mock
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2.14.0
Choose a head ref
  • 11 commits
  • 29 files changed
  • 5 contributors

Commits on Jun 23, 2023

  1. Copy the full SHA
    3b9169a View commit details

Commits on Jun 24, 2023

  1. Copy the full SHA
    cecca46 View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    4b8f654 View commit details

Commits on Jun 25, 2023

  1. Merge pull request #1177 from adobe/1163-store-headers

    Storage and retrieval headers like Content-Disposition
    afranken authored Jun 25, 2023

    Partially verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    We cannot verify signatures from co-authors, and some of the co-authors attributed to this commit require their commits to be signed.
    Copy the full SHA
    3748f9e View commit details

Commits on Jun 26, 2023

  1. Bump maven-clean-plugin from 3.2.0 to 3.3.1

    Bumps [maven-clean-plugin](https://github.com/apache/maven-clean-plugin) from 3.2.0 to 3.3.1.
    - [Release notes](https://github.com/apache/maven-clean-plugin/releases)
    - [Commits](apache/maven-clean-plugin@maven-clean-plugin-3.2.0...maven-clean-plugin-3.3.1)
    
    ---
    updated-dependencies:
    - dependency-name: org.apache.maven.plugins:maven-clean-plugin
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] committed Jun 26, 2023
    Copy the full SHA
    e71f9fa View commit details
  2. Bump spring-boot.version from 2.7.12 to 2.7.13

    Bumps `spring-boot.version` from 2.7.12 to 2.7.13.
    
    Updates `spring-boot-starter-parent` from 2.7.12 to 2.7.13
    - [Release notes](https://github.com/spring-projects/spring-boot/releases)
    - [Commits](spring-projects/spring-boot@v2.7.12...v2.7.13)
    
    Updates `spring-boot-maven-plugin` from 2.7.12 to 2.7.13
    - [Release notes](https://github.com/spring-projects/spring-boot/releases)
    - [Commits](spring-projects/spring-boot@v2.7.12...v2.7.13)
    
    ---
    updated-dependencies:
    - dependency-name: org.springframework.boot:spring-boot-starter-parent
      dependency-type: direct:production
      update-type: version-update:semver-patch
    - dependency-name: org.springframework.boot:spring-boot-maven-plugin
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] committed Jun 26, 2023
    Copy the full SHA
    b31bdef View commit details
  3. Bump aws-v2.version from 2.20.86 to 2.20.92

    Bumps `aws-v2.version` from 2.20.86 to 2.20.92.
    
    Updates `aws-query-protocol` from 2.20.86 to 2.20.92
    
    Updates `aws-xml-protocol` from 2.20.86 to 2.20.92
    
    Updates `s3` from 2.20.86 to 2.20.92
    
    Updates `url-connection-client` from 2.20.86 to 2.20.92
    
    Updates `aws-crt-client` from 2.20.86 to 2.20.92
    
    Updates `regions` from 2.20.86 to 2.20.92
    
    Updates `utils` from 2.20.86 to 2.20.92
    
    ---
    updated-dependencies:
    - dependency-name: software.amazon.awssdk:aws-query-protocol
      dependency-type: direct:production
      update-type: version-update:semver-patch
    - dependency-name: software.amazon.awssdk:aws-xml-protocol
      dependency-type: direct:production
      update-type: version-update:semver-patch
    - dependency-name: software.amazon.awssdk:s3
      dependency-type: direct:production
      update-type: version-update:semver-patch
    - dependency-name: software.amazon.awssdk:url-connection-client
      dependency-type: direct:production
      update-type: version-update:semver-patch
    - dependency-name: software.amazon.awssdk:aws-crt-client
      dependency-type: direct:development
      update-type: version-update:semver-patch
    - dependency-name: software.amazon.awssdk:regions
      dependency-type: direct:production
      update-type: version-update:semver-patch
    - dependency-name: software.amazon.awssdk:utils
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] committed Jun 26, 2023
    Copy the full SHA
    d9586be View commit details
  4. Bump aws-java-sdk-s3 from 1.12.488 to 1.12.494

    Bumps [aws-java-sdk-s3](https://github.com/aws/aws-sdk-java) from 1.12.488 to 1.12.494.
    - [Changelog](https://github.com/aws/aws-sdk-java/blob/master/CHANGELOG.md)
    - [Commits](aws/aws-sdk-java@1.12.488...1.12.494)
    
    ---
    updated-dependencies:
    - dependency-name: com.amazonaws:aws-java-sdk-s3
      dependency-type: direct:development
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] committed Jun 26, 2023
    Copy the full SHA
    656f4a7 View commit details
  5. Test that persisted file length is equal to uploaded file length

    For the CRT client, this did not work out-of-the-box because it enables
    checksums. Checksums are added by the AWS SDK to the payload of the
    body, this additional payload is currently ignored by S3Mock, so the
    persisted and the returned file contains the checksum.
    afranken committed Jun 26, 2023
    Copy the full SHA
    37bfba6 View commit details
  6. Changelog for 2.14.0

    afranken committed Jun 26, 2023
    Copy the full SHA
    5d1fee2 View commit details
  7. Copy the full SHA
    760acc3 View commit details
Showing with 276 additions and 114 deletions.
  1. +15 −1 CHANGELOG.md
  2. +1 −1 build-config/pom.xml
  3. +1 −1 docker/pom.xml
  4. +1 −1 integration-tests/pom.xml
  5. +30 −2 integration-tests/src/test/kotlin/com/adobe/testing/s3mock/its/CrtAsyncV2IT.kt
  6. +76 −1 integration-tests/src/test/kotlin/com/adobe/testing/s3mock/its/GetPutDeleteObjectV2IT.kt
  7. +2 −0 integration-tests/src/test/kotlin/com/adobe/testing/s3mock/its/S3TestBase.kt
  8. +6 −6 pom.xml
  9. +1 −1 server/pom.xml
  10. +5 −5 server/src/main/java/com/adobe/testing/s3mock/MultipartController.java
  11. +8 −8 server/src/main/java/com/adobe/testing/s3mock/ObjectController.java
  12. +3 −3 server/src/main/java/com/adobe/testing/s3mock/service/MultipartService.java
  13. +4 −8 server/src/main/java/com/adobe/testing/s3mock/service/ObjectService.java
  14. +4 −4 server/src/main/java/com/adobe/testing/s3mock/store/MultipartStore.java
  15. +4 −4 server/src/main/java/com/adobe/testing/s3mock/store/MultipartUploadInfo.java
  16. +5 −5 server/src/main/java/com/adobe/testing/s3mock/store/ObjectStore.java
  17. +11 −12 server/src/main/java/com/adobe/testing/s3mock/store/S3ObjectMetadata.java
  18. +26 −1 server/src/main/java/com/adobe/testing/s3mock/util/HeaderUtil.java
  19. +3 −3 server/src/test/java/com/adobe/testing/s3mock/ObjectControllerTest.java
  20. +25 −16 server/src/test/java/com/adobe/testing/s3mock/store/MultipartStoreTest.java
  21. +24 −18 server/src/test/java/com/adobe/testing/s3mock/store/ObjectStoreTest.java
  22. +12 −4 server/src/test/java/com/adobe/testing/s3mock/store/StoresWithExistingFileRootTest.java
  23. +3 −3 server/src/test/java/com/adobe/testing/s3mock/util/HeaderUtilTest.java
  24. +1 −1 testsupport/common/pom.xml
  25. +1 −1 testsupport/junit4/pom.xml
  26. +1 −1 testsupport/junit5/pom.xml
  27. +1 −1 testsupport/pom.xml
  28. +1 −1 testsupport/testcontainers/pom.xml
  29. +1 −1 testsupport/testng/pom.xml
16 changes: 15 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -105,7 +105,7 @@ Version 2.x is JDK8 LTS bytecode compatible, with Docker and JUnit / direct Java
* This will update all Spring Boot dependencies as well, including Spring Framework 6.x
* Bump java version from 8 to 17

## 2.14.0 - PLANNED
## 2.15.0 - PLANNED
2.x is JDK8 LTS bytecode compatible, with Docker and JUnit / direct Java integration.

* Features and fixes
@@ -116,6 +116,20 @@ Version 2.x is JDK8 LTS bytecode compatible, with Docker and JUnit / direct Java
* Version updates
* TBD

## 2.14.0
2.x is JDK8 LTS bytecode compatible, with Docker and JUnit / direct Java integration.

* Features and fixes
* Storage and retrieval headers like Content-Disposition (fixes #1163)
* Refactorings
* Test that persisted file length is equal to uploaded file length
* This does not work if checksum validation is enabled (see #1123)
* Version updates
* Bump spring-boot.version from 2.7.12 to 2.7.13
* Bump aws-v2.version from 2.20.86 to 2.20.92
* Bump aws-java-sdk-s3 from 1.12.488 to 1.12.494
* Bump maven-clean-plugin from 3.2.0 to 3.3.1

## 2.13.1
2.x is JDK8 LTS bytecode compatible, with Docker and JUnit / direct Java integration.

2 changes: 1 addition & 1 deletion build-config/pom.xml
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@
<parent>
<groupId>com.adobe.testing</groupId>
<artifactId>s3mock-parent</artifactId>
<version>2.13.1</version>
<version>2.14.0</version>
</parent>

<artifactId>s3mock-build-config</artifactId>
2 changes: 1 addition & 1 deletion docker/pom.xml
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@
<parent>
<groupId>com.adobe.testing</groupId>
<artifactId>s3mock-parent</artifactId>
<version>2.13.1</version>
<version>2.14.0</version>
</parent>

<artifactId>s3mock-docker</artifactId>
2 changes: 1 addition & 1 deletion integration-tests/pom.xml
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@
<parent>
<groupId>com.adobe.testing</groupId>
<artifactId>s3mock-parent</artifactId>
<version>2.13.1</version>
<version>2.14.0</version>
</parent>

<artifactId>s3mock-integration-tests</artifactId>
Original file line number Diff line number Diff line change
@@ -16,9 +16,9 @@

package com.adobe.testing.s3mock.its

import com.adobe.testing.s3mock.util.DigestUtil
import org.apache.commons.codec.digest.DigestUtils
import org.apache.commons.lang3.ArrayUtils
import org.assertj.core.api.Assertions
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.TestInfo
@@ -33,9 +33,36 @@ import software.amazon.awssdk.services.s3.model.GetObjectRequest
import software.amazon.awssdk.services.s3.model.PutObjectRequest
import software.amazon.awssdk.services.s3.model.UploadPartRequest
import java.io.File
import java.io.FileInputStream
import java.io.InputStream

internal class CrtAsyncV2IT : S3TestBase() {

@Test
@S3VerifiedTodo
fun testPutObject_etagCreation(testInfo: TestInfo) {
val uploadFile = File(UPLOAD_FILE_NAME)
val uploadFileIs: InputStream = FileInputStream(uploadFile)
val expectedEtag = "\"${DigestUtil.hexDigest(uploadFileIs)}\""

val bucketName = randomName
val bucketFuture =
autoS3CrtAsyncClientV2.createBucket(CreateBucketRequest.builder().bucket(bucketName).build())
bucketFuture.join()

val putObjectFuture = autoS3CrtAsyncClientV2.putObject(
PutObjectRequest.builder()
.bucket(bucketName)
.key(UPLOAD_FILE_NAME)
.build(),
AsyncRequestBody.fromFile(uploadFile)
)
val putObjectResponse = putObjectFuture.join()
val eTag = putObjectResponse.eTag()
assertThat(eTag).isNotBlank
assertThat(eTag).isEqualTo(expectedEtag)
}

@Test
@S3VerifiedTodo
fun testPutGetObject_successWithMatchingEtag(testInfo: TestInfo) {
@@ -62,7 +89,8 @@ internal class CrtAsyncV2IT : S3TestBase() {
AsyncResponseTransformer.toBytes()
)
val getObjectResponse = getObjectResponseCompletableFuture.join()
Assertions.assertThat(getObjectResponse.response().eTag()).isEqualTo(eTag)
assertThat(getObjectResponse.response().eTag()).isEqualTo(eTag)
assertThat(getObjectResponse.response().contentLength()).isEqualTo(uploadFile.length())
}

@Test
Original file line number Diff line number Diff line change
@@ -19,9 +19,9 @@ package com.adobe.testing.s3mock.its
import com.adobe.testing.s3mock.util.DigestUtil
import org.assertj.core.api.Assertions
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.TestInfo
import org.springframework.http.ContentDisposition
import software.amazon.awssdk.core.sync.RequestBody
import software.amazon.awssdk.services.s3.model.GetObjectRequest
import software.amazon.awssdk.services.s3.model.HeadObjectRequest
@@ -30,6 +30,8 @@ import software.amazon.awssdk.services.s3.model.S3Exception
import java.io.File
import java.io.FileInputStream
import java.io.InputStream
import java.time.Instant
import java.time.temporal.ChronoUnit

internal class GetPutDeleteObjectV2IT : S3TestBase() {

@@ -66,6 +68,61 @@ internal class GetPutDeleteObjectV2IT : S3TestBase() {
assertThat(object2.response().eTag()).isEqualTo(object2Again.response().eTag())
}

@Test
fun testPutGetHeadObject_storeHeaders(testInfo: TestInfo) {
val bucket = givenRandomBucketV2()
val uploadFile = File(UPLOAD_FILE_NAME)
val contentDisposition = ContentDisposition.formData()
.name("file")
.filename("sampleFile.txt")
.build()
.toString()
val expires = Instant.now()
val encoding = "SomeEncoding"
val contentLanguage = "SomeLanguage"
val cacheControl = "SomeCacheControl"

s3ClientV2.putObject(
PutObjectRequest.builder()
.bucket(bucket)
.key(UPLOAD_FILE_NAME)
.contentDisposition(contentDisposition)
.contentEncoding(encoding)
.expires(expires)
.contentLanguage(contentLanguage)
.cacheControl(cacheControl)
.build(),
RequestBody.fromFile(uploadFile))

val getObjectResponseResponse = getObjectV2(bucket, UPLOAD_FILE_NAME)

assertThat(getObjectResponseResponse.response().contentDisposition())
.isEqualTo(contentDisposition)
assertThat(getObjectResponseResponse.response().contentEncoding())
.isEqualTo(encoding)
// time in second precision, see
// https://www.rfc-editor.org/rfc/rfc7234#section-5.3
// https://www.rfc-editor.org/rfc/rfc7231#section-7.1.1.1
assertThat(getObjectResponseResponse.response().expires())
.isEqualTo(expires.truncatedTo(ChronoUnit.SECONDS))
assertThat(getObjectResponseResponse.response().contentLanguage())
.isEqualTo(contentLanguage)
assertThat(getObjectResponseResponse.response().cacheControl())
.isEqualTo(cacheControl)

val headObjectResponse = s3ClientV2.headObject(
HeadObjectRequest.builder()
.bucket(bucket)
.key(UPLOAD_FILE_NAME)
.build()
)
assertThat(headObjectResponse.contentDisposition()).isEqualTo(contentDisposition)
assertThat(headObjectResponse.contentEncoding()).isEqualTo(encoding)
assertThat(headObjectResponse.expires()).isEqualTo(expires.truncatedTo(ChronoUnit.SECONDS))
assertThat(headObjectResponse.contentLanguage()).isEqualTo(contentLanguage)
assertThat(headObjectResponse.cacheControl()).isEqualTo(cacheControl)
}

@Test
@S3VerifiedSuccess(year = 2022)
fun testGetObject_successWithMatchingEtag(testInfo: TestInfo) {
@@ -86,6 +143,24 @@ internal class GetPutDeleteObjectV2IT : S3TestBase() {
assertThat(responseInputStream.response().eTag()).isEqualTo(eTag)
}

@Test
@S3VerifiedTodo
fun testGetObject_successWithSameLength(testInfo: TestInfo) {
val uploadFile = File(UPLOAD_FILE_NAME)
val uploadFileIs: InputStream = FileInputStream(uploadFile)
val matchingEtag = "\"${DigestUtil.hexDigest(uploadFileIs)}\""

val (bucketName, _) = givenBucketAndObjectV2(testInfo, UPLOAD_FILE_NAME)
val responseInputStream = s3ClientV2.getObject(
GetObjectRequest.builder()
.bucket(bucketName)
.key(UPLOAD_FILE_NAME)
.ifMatch(matchingEtag)
.build()
)
assertThat(responseInputStream.response().contentLength()).isEqualTo(uploadFile.length())
}

@Test
@S3VerifiedSuccess(year = 2022)
fun testGetObject_successWithMatchingWildcardEtag(testInfo: TestInfo) {
Original file line number Diff line number Diff line change
@@ -229,6 +229,8 @@ internal abstract class S3TestBase {
.endpointOverride(URI.create("http://$host:$httpPort"))
.targetThroughputInGbps(20.0)
.minimumPartSizeInBytes((8 * MB).toLong())
//S3Mock currently does not support checksum validation. See #1123
.checksumValidationEnabled(false)
.build() as S3CrtAsyncClient;
}

12 changes: 6 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@

<groupId>com.adobe.testing</groupId>
<artifactId>s3mock-parent</artifactId>
<version>2.13.1</version>
<version>2.14.0</version>
<packaging>pom</packaging>

<name>S3Mock - Parent</name>
@@ -73,7 +73,7 @@
<scm>
<connection>scm:git:https://github.com/adobe/S3Mock.git</connection>
<developerConnection>scm:git:https://github.com/adobe/S3Mock.git</developerConnection>
<tag>2.13.1</tag>
<tag>2.14.0</tag>
<url>https://github.com/adobe/S3Mock/tree/main</url>
</scm>

@@ -89,9 +89,9 @@
</distributionManagement>

<properties>
<aws-v2.version>2.20.86</aws-v2.version>
<aws-v2.version>2.20.92</aws-v2.version>

<aws.version>1.12.488</aws.version>
<aws.version>1.12.494</aws.version>
<checkstyle.version>10.12.0</checkstyle.version>
<commons-codec.version>1.15</commons-codec.version>
<commons-io.version>2.13.0</commons-io.version>
@@ -105,7 +105,7 @@
<kotlin.version>1.8.22</kotlin.version>
<license-maven-plugin-git.version>4.2</license-maven-plugin-git.version>
<maven-checkstyle-plugin.version>3.3.0</maven-checkstyle-plugin.version>
<maven-clean-plugin.version>3.2.0</maven-clean-plugin.version>
<maven-clean-plugin.version>3.3.1</maven-clean-plugin.version>
<maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
<maven-deploy-plugin.version>3.1.1</maven-deploy-plugin.version>
<maven-enforcer-plugin.version>3.3.0</maven-enforcer-plugin.version>
@@ -124,7 +124,7 @@
<!-- Run Docker build by default -->
<skipDocker>false</skipDocker>
<sortpom-maven-plugin.version>3.2.1</sortpom-maven-plugin.version>
<spring-boot.version>2.7.12</spring-boot.version>
<spring-boot.version>2.7.13</spring-boot.version>
<spring-security-oauth2.version>2.5.2.RELEASE</spring-security-oauth2.version>
<testcontainers.version>1.18.3</testcontainers.version>
<testng.version>7.8.0</testng.version>
2 changes: 1 addition & 1 deletion server/pom.xml
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@
<parent>
<groupId>com.adobe.testing</groupId>
<artifactId>s3mock-parent</artifactId>
<version>2.13.1</version>
<version>2.14.0</version>
</parent>

<artifactId>s3mock</artifactId>
Original file line number Diff line number Diff line change
@@ -30,9 +30,9 @@
import static com.adobe.testing.s3mock.util.AwsHttpParameters.PART_NUMBER;
import static com.adobe.testing.s3mock.util.AwsHttpParameters.UPLOADS;
import static com.adobe.testing.s3mock.util.AwsHttpParameters.UPLOAD_ID;
import static com.adobe.testing.s3mock.util.HeaderUtil.getUserMetadata;
import static com.adobe.testing.s3mock.util.HeaderUtil.isV4ChunkedWithSigningEnabled;
import static org.springframework.http.HttpHeaders.CONTENT_ENCODING;
import static com.adobe.testing.s3mock.util.HeaderUtil.parseStoreHeaders;
import static com.adobe.testing.s3mock.util.HeaderUtil.parseUserMetadata;
import static org.springframework.http.HttpHeaders.CONTENT_TYPE;
import static org.springframework.http.MediaType.APPLICATION_XML_VALUE;

@@ -322,16 +322,16 @@ public ResponseEntity<InitiateMultipartUploadResult> createMultipartUpload(
value = X_AMZ_SERVER_SIDE_ENCRYPTION_AWS_KMS_KEY_ID,
required = false) String kmsKeyId,
@RequestHeader(value = CONTENT_TYPE, required = false) String contentType,
@RequestHeader(value = CONTENT_ENCODING, required = false) String contentEncoding,
@RequestHeader HttpHeaders httpHeaders) {
bucketService.verifyBucketExists(bucketName);

Map<String, String> userMetadata = getUserMetadata(httpHeaders);
Map<String, String> userMetadata = parseUserMetadata(httpHeaders);
Map<String, String> storeHeaders = parseStoreHeaders(httpHeaders);

String uploadId = UUID.randomUUID().toString();
InitiateMultipartUploadResult result =
multipartService.prepareMultipartUpload(bucketName, key.getKey(),
contentType, contentEncoding, uploadId,
contentType, storeHeaders, uploadId,
DEFAULT_OWNER, DEFAULT_OWNER, userMetadata);

return ResponseEntity.ok(result);
Original file line number Diff line number Diff line change
@@ -44,10 +44,10 @@
import static com.adobe.testing.s3mock.util.HeaderUtil.createEncryptionHeaders;
import static com.adobe.testing.s3mock.util.HeaderUtil.createOverrideHeaders;
import static com.adobe.testing.s3mock.util.HeaderUtil.createUserMetadataHeaders;
import static com.adobe.testing.s3mock.util.HeaderUtil.getUserMetadata;
import static com.adobe.testing.s3mock.util.HeaderUtil.isV4ChunkedWithSigningEnabled;
import static com.adobe.testing.s3mock.util.HeaderUtil.parseMediaType;
import static org.springframework.http.HttpHeaders.CONTENT_ENCODING;
import static com.adobe.testing.s3mock.util.HeaderUtil.parseStoreHeaders;
import static com.adobe.testing.s3mock.util.HeaderUtil.parseUserMetadata;
import static org.springframework.http.HttpHeaders.CONTENT_TYPE;
import static org.springframework.http.HttpHeaders.IF_MATCH;
import static org.springframework.http.HttpHeaders.IF_NONE_MATCH;
@@ -173,8 +173,8 @@ public ResponseEntity<Void> headObject(@PathVariable String bucketName,
objectService.verifyObjectMatching(match, noneMatch, s3ObjectMetadata);
return ResponseEntity.ok()
.eTag(s3ObjectMetadata.getEtag())
.header(HttpHeaders.CONTENT_ENCODING, s3ObjectMetadata.getContentEncoding())
.header(HttpHeaders.ACCEPT_RANGES, RANGES_BYTES)
.headers(headers -> headers.setAll(s3ObjectMetadata.getStoreHeaders()))
.headers(headers -> headers.setAll(createUserMetadataHeaders(s3ObjectMetadata)))
.headers(headers -> headers.setAll(createEncryptionHeaders(s3ObjectMetadata)))
.lastModified(s3ObjectMetadata.getLastModified())
@@ -254,8 +254,8 @@ public ResponseEntity<StreamingResponseBody> getObject(@PathVariable String buck
return ResponseEntity
.ok()
.eTag(s3ObjectMetadata.getEtag())
.header(HttpHeaders.CONTENT_ENCODING, s3ObjectMetadata.getContentEncoding())
.header(HttpHeaders.ACCEPT_RANGES, RANGES_BYTES)
.headers(headers -> headers.setAll(s3ObjectMetadata.getStoreHeaders()))
.headers(headers -> headers.setAll(createUserMetadataHeaders(s3ObjectMetadata)))
.headers(headers -> headers.setAll(createEncryptionHeaders(s3ObjectMetadata)))
.lastModified(s3ObjectMetadata.getLastModified())
@@ -531,7 +531,6 @@ public ResponseEntity<Void> putObject(@PathVariable String bucketName,
value = X_AMZ_SERVER_SIDE_ENCRYPTION_AWS_KMS_KEY_ID,
required = false) String kmsKeyId,
@RequestHeader(name = X_AMZ_TAGGING, required = false) List<Tag> tags,
@RequestHeader(value = CONTENT_ENCODING, required = false) String contentEncoding,
@RequestHeader(value = CONTENT_TYPE, required = false) String contentType,
@RequestHeader(value = CONTENT_MD5, required = false) String contentMd5,
@RequestHeader(value = X_AMZ_CONTENT_SHA256, required = false) String sha256Header,
@@ -542,12 +541,13 @@ public ResponseEntity<Void> putObject(@PathVariable String bucketName,
InputStream stream = objectService.verifyMd5(inputStream, contentMd5, sha256Header);
//TODO: need to extract owner from headers
Owner owner = Owner.DEFAULT_OWNER;
Map<String, String> userMetadata = getUserMetadata(headers);
Map<String, String> userMetadata = parseUserMetadata(headers);
Map<String, String> storeHeaders = parseStoreHeaders(headers);
S3ObjectMetadata s3ObjectMetadata =
objectService.putS3Object(bucketName,
key.getKey(),
parseMediaType(contentType).toString(),
contentEncoding,
storeHeaders,
stream,
isV4ChunkedWithSigningEnabled(sha256Header),
userMetadata,
@@ -614,7 +614,7 @@ public ResponseEntity<CopyObjectResult> copyObject(@PathVariable String bucketNa

Map<String, String> metadata = Collections.emptyMap();
if (MetadataDirective.REPLACE == metadataDirective) {
metadata = getUserMetadata(httpHeaders);
metadata = parseUserMetadata(httpHeaders);
}

//TODO: this is potentially illegal on S3. S3 throws a 400:
Loading