Repository: cxf Updated Branches: refs/heads/master 8c4dab45a -> b53208275
[CXF-6484] Regression in Content-id format - applying patch from 2.7.x pull request - Thanks Chris Dolphy Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/b5320827 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/b5320827 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/b5320827 Branch: refs/heads/master Commit: b5320827561467de7e04afdba15a6063d26493a3 Parents: 8c4dab4 Author: Alessio Soldano <[email protected]> Authored: Wed Jul 22 21:24:32 2015 +0200 Committer: Alessio Soldano <[email protected]> Committed: Wed Jul 22 21:24:32 2015 +0200 ---------------------------------------------------------------------- .../main/java/org/apache/cxf/attachment/AttachmentUtil.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/b5320827/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java b/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java index ba82579..a054ca2 100644 --- a/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java +++ b/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java @@ -24,6 +24,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.net.MalformedURLException; +import java.net.URI; import java.net.URL; import java.net.URLDecoder; import java.net.URLEncoder; @@ -196,7 +197,12 @@ public final class AttachmentUtil { String name = ATT_UUID + "-" + String.valueOf(++counter); if (ns != null && (ns.length() > 0)) { - cid = ns; + try { + URI uri = new URI(ns); + cid = uri.getHost(); + } catch (Exception e) { + cid = ns; + } } return URLEncoder.encode(name, "UTF-8") + "@" + URLEncoder.encode(cid, "UTF-8"); }
