This is an automated email from the ASF dual-hosted git repository.
adoroszlai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/master by this push:
new 3359f347c03 HDDS-17319. Ignore decoded content length for
non-streaming PutObject (#11714)
3359f347c03 is described below
commit 3359f347c0328749ba79b64e54a920289b18eeb5
Author: Andy Huang <[email protected]>
AuthorDate: Sat Oct 31 16:51:13 2026 +0800
HDDS-17319. Ignore decoded content length for non-streaming PutObject
(#11714)
---
.../hadoop/ozone/s3/endpoint/TestObjectPut.java | 24 ++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git
a/hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/s3/endpoint/TestObjectPut.java
b/hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/s3/endpoint/TestObjectPut.java
index cf3223ca083..5d385a378a3 100644
---
a/hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/s3/endpoint/TestObjectPut.java
+++
b/hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/s3/endpoint/TestObjectPut.java
@@ -204,6 +204,18 @@ void testPutObject(int length, ReplicationConfig
replication) throws Exception {
assertThat(keyDetails.getTags()).isEmpty();
}
+ @ParameterizedTest
+ @NullAndEmptySource
+ @ValueSource(strings = {"abc", "99999999999999999999", "0", "37"})
+ void testNonStreamingPutIgnoresDecodedContentLength(String decodedLength)
throws Exception {
+
when(headers.getHeaderString(X_AMZ_CONTENT_SHA256)).thenReturn(UNSIGNED_PAYLOAD);
+
when(headers.getHeaderString(DECODED_CONTENT_LENGTH_HEADER)).thenReturn(decodedLength);
+
+ assertSucceeds(() -> putObject(CONTENT));
+
+ assertThat(assertKeyContent(bucket, KEY_NAME,
CONTENT).getDataSize()).isEqualTo(CONTENT.length());
+ }
+
@ParameterizedTest
@ValueSource(booleans = {false, true})
void testRejectMalformedContentSha256BeforeReadingBody(boolean streaming)
throws Exception {
@@ -1294,6 +1306,18 @@ void
testDirectoryCreationRejectsUnsignedDecodedLengthMismatch() {
assertThatThrownBy(() ->
fsoBucket.getKey("dir/")).isInstanceOf(IOException.class);
}
+ @Test
+ void testNonStreamingPutWithDecodedLengthZeroDoesNotCreateDirectory() throws
Exception {
+ String path = "dir/";
+
when(headers.getHeaderString(X_AMZ_CONTENT_SHA256)).thenReturn(UNSIGNED_PAYLOAD);
+
when(headers.getHeaderString(DECODED_CONTENT_LENGTH_HEADER)).thenReturn("0");
+
+ assertSucceeds(() -> putObject(FSO_BUCKET_NAME, path));
+
+ OzoneKeyDetails key = assertKeyContent(fsoBucket, path, CONTENT);
+ assertThat(key.isFile()).isTrue();
+ }
+
@Test
void testDirectoryCreationOverFile() throws Exception {
// GIVEN
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]