F64116045 commented on code in PR #11387:
URL: https://github.com/apache/ozone/pull/11387#discussion_r4229511526


##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/EndpointBase.java:
##########
@@ -470,6 +480,58 @@ protected Map<String, String> getCustomMetadataFromHeaders(
     return customMetadata;
   }
 
+  private static String decodeRfc2047MetadataValue(String value) {
+    if (!value.startsWith("=?")) {
+      return value;
+    }
+
+    int charsetEnd = value.indexOf('?', 2);
+    int encodingEnd = charsetEnd < 0 ? -1 : value.indexOf('?', charsetEnd + 1);
+    int encodedTextEnd = encodingEnd < 0
+        ? -1 : value.indexOf("?=", encodingEnd + 1);
+    if (encodedTextEnd != value.length() - 2
+        || value.indexOf('?', encodingEnd + 1) != encodedTextEnd) {
+      return value;

Review Comment:
   Oops I missed that case, thanks for catching it. 
   Also I checked a few other malformed values while fixing it, found similar 
issues, and added tests for those too.



-- 
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