commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mart...@apache.org
Subject svn commit: r349295 - /jakarta/commons/proper/fileupload/trunk/src/java/org/apache/commons/fileupload/FileUploadBase.java
Date Sun, 27 Nov 2005 20:15:52 GMT
Author: martinc
Date: Sun Nov 27 12:15:47 2005
New Revision: 349295

URL: http://svn.apache.org/viewcvs?rev=349295&view=rev
Log:
Bugzilla #34497 - Null check and case insensitivity.

Modified:
    jakarta/commons/proper/fileupload/trunk/src/java/org/apache/commons/fileupload/FileUploadBase.java

Modified: jakarta/commons/proper/fileupload/trunk/src/java/org/apache/commons/fileupload/FileUploadBase.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/fileupload/trunk/src/java/org/apache/commons/fileupload/FileUploadBase.java?rev=349295&r1=349294&r2=349295&view=diff
==============================================================================
--- jakarta/commons/proper/fileupload/trunk/src/java/org/apache/commons/fileupload/FileUploadBase.java
(original)
+++ jakarta/commons/proper/fileupload/trunk/src/java/org/apache/commons/fileupload/FileUploadBase.java
Sun Nov 27 12:15:47 2005
@@ -424,19 +424,22 @@
     protected String getFileName(Map /* String, String */ headers) {
         String fileName = null;
         String cd = getHeader(headers, CONTENT_DISPOSITION);
-        if (cd.startsWith(FORM_DATA) || cd.startsWith(ATTACHMENT)) {
-            ParameterParser parser = new ParameterParser();
-            parser.setLowerCaseNames(true);
-            // Parameter parser can handle null input
-            Map params = parser.parse(cd, ';');
-            if (params.containsKey("filename")) {
-                fileName = (String) params.get("filename");
-                if (fileName != null) {
-                    fileName = fileName.trim();
-                } else {
-                    // Even if there is no value, the parameter is present, so
-                    // we return an empty file name rather than no file name.
-                    fileName = "";
+        if (cd != null) {
+            cd = cd.toLowerCase();
+            if (cd.startsWith(FORM_DATA) || cd.startsWith(ATTACHMENT)) {
+                ParameterParser parser = new ParameterParser();
+                parser.setLowerCaseNames(true);
+                // Parameter parser can handle null input
+                Map params = parser.parse(cd, ';');
+                if (params.containsKey("filename")) {
+                    fileName = (String) params.get("filename");
+                    if (fileName != null) {
+                        fileName = fileName.trim();
+                    } else {
+                        // Even if there is no value, the parameter is present, so
+                        // we return an empty file name rather than no file name.
+                        fileName = "";
+                    }
                 }
             }
         }
@@ -455,7 +458,7 @@
     protected String getFieldName(Map /* String, String */ headers) {
         String fieldName = null;
         String cd = getHeader(headers, CONTENT_DISPOSITION);
-        if (cd != null && cd.startsWith(FORM_DATA)) {
+        if (cd != null && cd.toLowerCase().startsWith(FORM_DATA)) {
 
             ParameterParser parser = new ParameterParser();
             parser.setLowerCaseNames(true);



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message