Gargi-jais11 commented on code in PR #10472:
URL: https://github.com/apache/ozone/pull/10472#discussion_r3440247604


##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/ObjectEndpoint.java:
##########
@@ -463,6 +466,13 @@ Response handleGetRequest(ObjectRequestContext context, 
String keyPath)
 
       for (Map.Entry<String, String> entry : 
overrideQueryParameter.entrySet()) {
         String headerValue = getHeaders().getHeaderString(entry.getKey());
+        // Default the response Content-Type to the object's stored 
Content-Type
+        // (or the standard default) so it is always returned; a
+        // response-content-type query parameter still overrides it below.
+        if (headerValue == null
+            && HttpHeaders.CONTENT_TYPE.equals(entry.getKey())) {
+          headerValue = contentTypeOf(keyDetails);
+        }

Review Comment:
   @rich7420 It correctly returns the stored `Content-Type` when the **GET** 
request has none. If the client sends a **Content-Type header on GET**, the 
existing override loop still uses that request value instead of the object’s 
stored type.
   
   Example: 
   ```
   object stored as image/jpeg,
   GET with Content-Type: text/plain    →   
   response is text/plain (Ozone today) vs image/jpeg (AWS S3). 
   ```
   Only `response-content-type` should override. So base **Content-Type** on 
**contentTypeOf(key)** and ignore the request header; keep query-param override 
as-is.



##########
hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/s3/endpoint/TestObjectGet.java:
##########


Review Comment:
   After the above change this should be corrected for **Content-Type**:
   
   Before: expects request value video/mp4
   After: expects stored/default — for key1 in that test setup, 
binary/octet-stream (no stored type)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to