You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by GitBox <gi...@apache.org> on 2020/10/12 13:22:10 UTC

[GitHub] [cxf] reta commented on a change in pull request #707: [CXF-8353] MediaType validation

reta commented on a change in pull request #707:
URL: https://github.com/apache/cxf/pull/707#discussion_r503292114



##########
File path: rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/MediaTypeHeaderProvider.java
##########
@@ -190,4 +190,35 @@ private static MediaType handleMediaTypeWithoutSubtype(String mType) {
         }
         throw new IllegalArgumentException("Media type separator is missing");
     }
+
+    // Determines whether the type or subtype contains any of the tspecials characters defined at:
+    // https://tools.ietf.org/html/rfc2045#section-5.1
+    private static boolean isValid(String str) {
+        final int len = str.length();

Review comment:
       Minor, may be check `str.trim().length()`, it seems weird media types like `application/   ` are still passing through.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org