You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rg...@apache.org on 2016/09/29 11:16:08 UTC

svn commit: r1762755 - /qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java

Author: rgodfrey
Date: Thu Sep 29 11:16:08 2016
New Revision: 1762755

URL: http://svn.apache.org/viewvc?rev=1762755&view=rev
Log:
QPID-7379 : address review comment on filename for export

Modified:
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java?rev=1762755&r1=1762754&r2=1762755&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java (original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java Thu Sep 29 11:16:08 2016
@@ -925,8 +925,17 @@ public abstract class AbstractVirtualHos
         {
             try
             {
-                return String.format("attachment; filename=\"%s_messages.bin\"",
-                                     URLEncoder.encode(getName(), StandardCharsets.UTF_8.name()));
+
+                String vhostName = getName();
+                // replace all non-ascii and non-printable characters and all backslashes and percent encoded characters
+                // as suggested by rfc6266 Appendix D
+                String asciiName = vhostName.replaceAll("[^\\x20-\\x7E]", "?")
+                                                 .replace('\\', '?')
+                                                 .replaceAll("%[0-9a-fA-F]{2}", "?");
+                String disposition = String.format("attachment; filename=\"%s_messages%09dbin\"; filename*=\"UTF-8''%s_messages%09dbin\"",
+                                                   asciiName,
+                                                   URLEncoder.encode(vhostName, StandardCharsets.UTF_8.name())
+                                                   );
             }
             catch (UnsupportedEncodingException e)
             {



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org