cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1099654 - in /cxf/branches/2.3.x-fixes: ./ rt/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java
Date Thu, 05 May 2011 01:40:01 GMT
Author: dkulp
Date: Thu May  5 01:40:01 2011
New Revision: 1099654

URL: http://svn.apache.org/viewvc?rev=1099654&view=rev
Log:
Merged revisions 1096623 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1096623 | bimargulies | 2011-04-25 18:34:31 -0400 (Mon, 25 Apr 2011) | 1 line
  
  Fix content ids in multipart.
........

Modified:
    cxf/branches/2.3.x-fixes/   (props changed)
    cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java?rev=1099654&r1=1099653&r2=1099654&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java
Thu May  5 01:40:01 2011
@@ -152,14 +152,23 @@ public final class AttachmentUtil {
         throws IOException {
      
         String id = headers.getHeader("Content-ID", null);
-        if (id != null && id.startsWith("<")) {
-            id = id.substring(1, id.length() - 1);
-        } else {
+        if (id != null) {
+            if (id.startsWith("<")) {
+                // strip <>
+                id = id.substring(1, id.length() - 1);
+            }
+            // strip cid:
+            if (id.startsWith("cid:")) {
+                id = id.substring(4);
+            }
+            // urldecode. Is this bad even without cid:? What does decode do with malformed
%-signs, anyhow?
+            id = URLDecoder.decode(id, "UTF-8");
+        }
+        if (id == null) {
             //no Content-ID, set cxf default ID
-            id = "Content-ID: <root.message@cxf.apache.org";
+            id = "root.message@cxf.apache.org";
         }
 
-        id = URLDecoder.decode(id.startsWith("cid:") ? id.substring(4) : id, "UTF-8");
 
         AttachmentImpl att = new AttachmentImpl(id);
         



Mime
View raw message