struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yasserzam...@apache.org
Subject [struts] 01/01: Revert "[WW-4958] Uses less restrictive RegEx to check if it's a multipart request"
Date Sun, 14 Apr 2019 09:50:14 GMT
This is an automated email from the ASF dual-hosted git repository.

yasserzamani pushed a commit to branch revert-344-WW-4958
in repository https://gitbox.apache.org/repos/asf/struts.git

commit 7d77910b2352514f330ec30f25c95fb7c02a564c
Author: Yasser Zamani <yasser.zamani@live.com>
AuthorDate: Sun Apr 14 14:20:07 2019 +0430

    Revert "[WW-4958] Uses less restrictive RegEx to check if it's a multipart request"
---
 .../org/apache/struts2/dispatcher/Dispatcher.java  |  2 +-
 .../apache/struts2/dispatcher/DispatcherTest.java  | 36 ----------------------
 2 files changed, 1 insertion(+), 37 deletions(-)

diff --git a/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java b/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
index 87dc908..dcc5fe7 100644
--- a/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
+++ b/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
@@ -85,7 +85,7 @@ public class Dispatcher {
      */
     public static final String REQUEST_POST_METHOD = "POST";
 
-    public static final String MULTIPART_FORM_DATA_REGEX = "^multipart/form-data(?:\\s*;\\s*boundary\\s?=[0-9a-zA-Z'()+_,\\-./:=?]{1,70})?(?:\\s*;\\s*charset\\s?=\\s?[a-zA-Z\\-0-9]{3,14})?";
+    public static final String MULTIPART_FORM_DATA_REGEX = "^multipart/form-data(; boundary=[0-9a-zA-Z'()+_,\\-./:=?]{1,70})?(;charset=[a-zA-Z\\-0-9]{3,14})?";
 
     /**
      * Provide a thread local instance.
diff --git a/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java b/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java
index 5b0989a..7e25fb1 100644
--- a/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java
+++ b/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java
@@ -319,42 +319,6 @@ public class DispatcherTest extends StrutsInternalTestCase {
 
         req.setContentType("multipart/form-data; boundary=---------------------------207103069210263;charset=UTF-16LE");
         assertTrue(du.isMultipartRequest(req));
-
-        req.setContentType("multipart/form-data;boundary=---------------------------207103069210263;charset=UTF-16LE");
-        assertTrue(du.isMultipartRequest(req));
-
-        req.setContentType("multipart/form-data;boundary=---------------------------207103069210263
; charset = UTF-16LE");
-        assertTrue(du.isMultipartRequest(req));
-
-        req.setContentType("multipart/form-data;boundary=---------------------------207103069210263;charset
= UTF-16LE");
-        assertTrue(du.isMultipartRequest(req));
-
-        req.setContentType("multipart/form-data;boundary=---------------------------207103069210263;charset=
UTF-16LE");
-        assertTrue(du.isMultipartRequest(req));
-
-        req.setContentType("multipart/form-data;boundary=---------------------------207103069210263;charset
=UTF-16LE");
-        assertTrue(du.isMultipartRequest(req));
-
-        req.setContentType("multipart/form-data;boundary=---------------------------207103069210263;
charset=UTF-16LE");
-        assertTrue(du.isMultipartRequest(req));
-
-        req.setContentType("multipart/form-data;boundary=---------------------------207103069210263
;charset=UTF-16LE");
-        assertTrue(du.isMultipartRequest(req));
-
-        req.setContentType("multipart/form-data;boundary=---------------------------207103069210263
; charset=UTF-16LE");
-        assertTrue(du.isMultipartRequest(req));
-
-        req.setContentType("multipart/form-data ;boundary=---------------------------207103069210263;charset=UTF-16LE");
-        assertTrue(du.isMultipartRequest(req));
-
-        req.setContentType("multipart/form-data ; boundary=---------------------------207103069210263;charset=UTF-16LE");
-        assertTrue(du.isMultipartRequest(req));
-
-        req.setContentType("multipart/form-data;boundary =---------------------------207103069210263;charset=UTF-16LE");
-        assertTrue(du.isMultipartRequest(req));
-
-        req.setContentType("Multipart/Form-Data ; boundary=---------------------------207103069210263;charset=UTF-16LE");
-        assertTrue(du.isMultipartRequest(req));
     }
 
     class InternalConfigurationManager extends ConfigurationManager {


Mime
View raw message