Jeroen Hoffman pushed to branch release/4.1 at cms-community / 
hippo-site-toolkit


Commits:
18bcd5cf by Bert Leunis at 2016-12-22T16:21:02+01:00
HSTTWO-3892 added the sip: protocal as new external protocol

- - - - -
73dcb1c1 by Bert Leunis at 2016-12-22T16:29:24+01:00
HSTTWO-3892 Merge release/4.1 changes in feature/HSTTWO-3892

- - - - -
2268f7b2 by Jeroen Hoffman at 2017-01-02T14:29:41+01:00
HSTTWO-3892 Reintegrate branch 'feature/HSTTWO-3892' into release/4.1

- - - - -


2 changed files:

- 
components/rewriter/src/main/java/org/hippoecm/hst/content/rewriter/impl/SimpleContentRewriter.java
- 
components/rewriter/src/test/java/org/hippoecm/hst/content/rewriter/impl/TestSimpleContentRewriter.java


Changes:

=====================================
components/rewriter/src/main/java/org/hippoecm/hst/content/rewriter/impl/SimpleContentRewriter.java
=====================================
--- 
a/components/rewriter/src/main/java/org/hippoecm/hst/content/rewriter/impl/SimpleContentRewriter.java
+++ 
b/components/rewriter/src/main/java/org/hippoecm/hst/content/rewriter/impl/SimpleContentRewriter.java
@@ -61,7 +61,8 @@ public class SimpleContentRewriter extends 
AbstractContentRewriter<String> {
         "tel:", 
         "sms:",
         "/",
-        "$" };
+        "$",
+        "sip:" };
 
     protected static final String LINK_TAG = "<a";
     protected static final String IMG_TAG = "<img";


=====================================
components/rewriter/src/test/java/org/hippoecm/hst/content/rewriter/impl/TestSimpleContentRewriter.java
=====================================
--- 
a/components/rewriter/src/test/java/org/hippoecm/hst/content/rewriter/impl/TestSimpleContentRewriter.java
+++ 
b/components/rewriter/src/test/java/org/hippoecm/hst/content/rewriter/impl/TestSimpleContentRewriter.java
@@ -1,5 +1,5 @@
 /*
- *  Copyright 2008-2015 Hippo B.V. (http://www.onehippo.com)
+ *  Copyright 2008-2016 Hippo B.V. (http://www.onehippo.com)
  * 
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -82,6 +82,16 @@ public class TestSimpleContentRewriter {
             "<img 
src=\"http://upload.wikimedia.org/wikipedia/commons/3/31/Red-dot-5px.png\"; 
alt=\"Red dot\"/>\n" +
             "</div>";
 
+    private static final String CONTENT_WITH_EXTERNAL_PROTOCOLS =
+            "<html>\n" +
+            "<head>\n" +
+            "<title>Hello</title>\n" +
+            "</head>\n" +
+            "<body>" +
+            "<a href=\"sip:m...@provider.com\">sip-protocol</a>" +
+            "</body>\n" +
+            "</html>";
+
     private Node node;
     private HstRequestContext requestContext;
     private Mount mount;
@@ -156,6 +166,13 @@ public class TestSimpleContentRewriter {
     }
 
     @Test
+    public void testContentWithExternalProtocols() {
+        ContentRewriter<String> rewriter = new SimpleContentRewriter();
+        String html = rewriter.rewrite(CONTENT_WITH_EXTERNAL_PROTOCOLS, node, 
requestContext, mount);
+        assertTrue(html.contains("href=\"sip:m...@provider.com\""));
+    }
+
+    @Test
     public void testSimpleLinkRewriting() throws Exception {
         ContentRewriter<String> rewriter = new SimpleContentRewriter() {
             @Override



View it on GitLab: 
https://code.onehippo.org/cms-community/hippo-site-toolkit/compare/e4a65f11897fe1a310238988a4eeb615364b7b49...2268f7b2107426d5eededecff7ddfa1f6e3512b6
_______________________________________________
Hippocms-svn mailing list
Hippocms-svn@lists.onehippo.org
https://lists.onehippo.org/mailman/listinfo/hippocms-svn

Reply via email to