Skip to content
Merged

etags #143

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ private static void putOrUploadPartHandler(Context ctx, StorageService storage)
}

ctx.status(200);
ctx.header("ETag", "\"" + UUID.randomUUID().toString().replace("-", "") + "\"");
ctx.result("");
} else {
InputStream data = ctx.bodyInputStream();
Expand All @@ -381,6 +382,7 @@ private static void putOrUploadPartHandler(Context ctx, StorageService storage)
return;
}
ctx.status(200);
ctx.header("ETag", "\"" + UUID.randomUUID().toString().replace("-", "") + "\"");
ctx.result("");
}
} catch (UnsupportedOperationException e) {
Expand Down Expand Up @@ -572,11 +574,13 @@ private static String buildInitiateMultipartUploadXml(String bucket, String key,

private static String buildCompleteMultipartUploadXml(String bucket, String key) {
String encodedKey = URLEncoder.encode(key, StandardCharsets.UTF_8).replace("+", "%20");
String etag = UUID.randomUUID().toString().replace("-", "");
return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<CompleteMultipartUploadResult xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\">\n" +
" <Location>http://localhost:8080/" + escapeXml(bucket) + "/" + encodedKey + "</Location>\n" +
" <Bucket>" + escapeXml(bucket) + "</Bucket>\n" +
" <Key>" + escapeXml(key) + "</Key>\n" +
" <ETag>\"" + etag + "\"</ETag>\n" +
"</CompleteMultipartUploadResult>";
}

Expand Down
8 changes: 8 additions & 0 deletions system-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@
<scope>test</scope>
</dependency>

<!-- High-level transfer manager (uploadFile / downloadFile) -->
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>s3-transfer-manager</artifactId>
<version>2.41.34</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
Expand Down
Loading
Loading