svn commit: r1690086 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilHttp.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1690086 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilHttp.java

jleroux@apache.org
Author: jleroux
Date: Thu Jul  9 12:30:22 2015
New Revision: 1690086

URL: http://svn.apache.org/r1690086
Log:
A patch from Francis Douet for "streamContentToBrowser fails when the file name contains a comma, only with Chrome." https://issues.apache.org/jira/browse/OFBIZ-6554

streamContentToBrowser fails when the file name contains a comma, happens only with Google Chrome.
Can easily be reproduced for example by uploading the Logo Image URL of the default organization in the party manager, that includes a comma of course.
Fixed in my patch by wrapping the file name in quotes.
Error on the browser console:
GET https://localhost:8443/content/control/stream?contentId=10020 net::ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_DISPOSITION

jleroux: at 1935.1 section of http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html I read this example << Content-Disposition: attachment; filename="fname.ext">> So Francis's solution is the right one

Modified:
    ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilHttp.java

Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilHttp.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilHttp.java?rev=1690086&r1=1690085&r2=1690086&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilHttp.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilHttp.java Thu Jul  9 12:30:22 2015
@@ -933,7 +933,7 @@ public class UtilHttp {
             response.setContentType(contentType);
         }
         if (fileName != null) {
-            response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
+            response.setHeader("Content-Disposition", "attachment;filename=\"" + fileName + "\"");
         }
 
         // create the streams
@@ -982,7 +982,7 @@ public class UtilHttp {
             response.setContentType(contentType);
         }
         if (fileName != null) {
-            response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
+            response.setHeader("Content-Disposition", "attachment;filename=\"" + fileName + "\"");
         }
 
         // stream the content