[ 
https://issues.apache.org/jira/browse/CXF-7317?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16501709#comment-16501709
 ] 

ASF GitHub Bot commented on CXF-7317:
-------------------------------------

deki closed pull request #408: [CXF-7317] Non-URL encoded Content-Id href does 
not seem be serialized by CXF's AttachmentSerializer
URL: https://github.com/apache/cxf/pull/408
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/core/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java 
b/core/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java
index df94235483a..3a86c406c5f 100644
--- a/core/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java
+++ b/core/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java
@@ -24,7 +24,6 @@
 import java.io.OutputStream;
 import java.io.StringWriter;
 import java.io.Writer;
-import java.net.URLDecoder;
 import java.nio.charset.StandardCharsets;
 import java.util.Collections;
 import java.util.Iterator;
@@ -215,7 +214,7 @@ private void writeHeaders(String contentType, String 
attachmentId,
         if (attachmentId != null) {
             attachmentId = checkAngleBrackets(attachmentId);
             writer.write("Content-ID: <");
-            writer.write(URLDecoder.decode(attachmentId, 
StandardCharsets.UTF_8.name()));
+            writer.write(attachmentId);
             writer.write(">\r\n");
         }
         // headers like Content-Disposition need to be serialized


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Non-URL encoded Content-Id href does not seem be serialized by CXF's 
> AttachmentSerializer
> -----------------------------------------------------------------------------------------
>
>                 Key: CXF-7317
>                 URL: https://issues.apache.org/jira/browse/CXF-7317
>             Project: CXF
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 3.1.10
>            Reporter: Viral Gohel
>            Priority: Major
>             Fix For: 3.2.5
>
>         Attachments: mtomExample.war
>
>
> CXF-6484 states that, 
> >> URL-encoded content ID for MTOM attachments causes problems with web 
> >> service clients.  This is effectively a regression on:
>   https://issues.apache.org/jira/browse/CXF-2669
> For example, If the namespace is "https://cxf.apache.org/"; for the service 
> endpoint, then the content id is now:
>  5726d366-df25-4945-9f3b-3003a2ae8a70-3@http%3A%2F%2Fcxf.apache.org%2F
> It was previously:
>  [email protected]
> Hence, 
> Actual results:
> Content Id contains the full namespace (as URL) which is URL encoded: 
> 5726d366-df25-4945-9f3b-3003a2ae8a70-3@http%3A%2F%2Fcxf.apache.org%2F
> Expected results:
> Content id does not require encoding and only contains hostname:  
> [email protected]
> With the attached reproducer, here's what the results looks like, 
> Actual Result - 
> href="cid:0842d204-23ec-4b6f-955b-0e38a4c2f35a-1@urn%3Awsc.td.com%2Fcis%2F2010%2F01%2F19
> Expected Result -
> href="cid:0842d204-23ec-4b6f-955b-0e38a4c2f35a-1@urn:Awsc.td.com/cis/2010/01/19
> The difference here compared to the fix for CXF-6484, is that a non-url 
> encoded href using namespace with 'urn:' for the attachments is used. 
> For example, like the below in the @WebService class, 
> @WebService(targetNamespace = "urn:wsc.td.com/cis/2010/01/19")
> To me, it seems that the fix for CXF-6484 does not work for non-url encoded 
> href. 
> I.e After the fix of CXF-6484, 
> Actual Result - 
> href="cid:0842d204-23ec-4b6f-955b-0e38a4c2f35a-1@urn%3Awsc.td.com%2Fcis%2F2010%2F01%2F19
> Expected Result -
> href="cid:0842d204-23ec-4b6f-955b-0e38a4c2f35a-1@urn:Awsc.td.com/cis/2010/01/19
> It looks like CXF's AttachmentSerializer is not able to serialize the forward 
> slashes(/) or the AttachmentUtil needs to be changed. 
> I am not sure if the proper urn: namespaces should be of format, i.e 
> urn:com.namespace.someResource or it can be also like, 
> urn:com/namespace/someResource.  
> Can we make CXF to interpret and display the href in the Content-Id with 
> non-url namespace as 
> cid:0842d204-23ec-4b6f-955b-0e38a4c2f35a-1@urn:Awsc.td.com/cis/2010/01/19 ?
> instead of 
> href="cid:0842d204-23ec-4b6f-955b-0e38a4c2f35a-1@urn%3Awsc.td.com%2Fcis%2F2010%2F01%2F19



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to