{"push_id":592292370,"size":1,"distinct_size":1,"ref":"refs/heads/5.0","head":"16b4df199fa538071e6c2174cc5a3efd6c8ad657","before":"d9096acc87c60819f59c0622f80837f230f5866f","commits":[{"sha":"16b4df199fa538071e6c2174cc5a3efd6c8ad657","author":{"email":"5ab48fab280b31078b7d9c1b738a03f0e28b0a79@adm.at","name":"thet"},"message":"[fc] Repository: plone.app.contenttypes\nBranch: refs/heads/master\nDate: 2015-03-05T00:52:40+01:00\nAuthor: Johannes Raggam (thet) <raggam-nl@adm.at>\nCommit: https://github.com/plone/plone.app.contenttypes/commit/61aaacf59a54d42fe48cec4cd90162d90667823d\n\nFor the link_redirect_view, don't modify the urls for mailto:, tel:, callto: and file: link types but render them as-is.\n\nFiles changed:\nM docs/CHANGES.rst\nM plone/app/contenttypes/browser/link_redirect_view.py\nM plone/app/contenttypes/tests/test_link.py\n\ndiff --git a/docs/CHANGES.rst b/docs/CHANGES.rst\nindex 61d9679..e5495af 100644\n--- a/docs/CHANGES.rst\n+++ b/docs/CHANGES.rst\n@@ -4,6 +4,10 @@ Changelog\n 1.2 (unreleased)\n ----------------\n \n+- For the link_redirect_view, don't modify the urls for ``mailto:``, ``tel:``,\n+  ``callto:`` and ``file:`` link types but render them as-is.\n+  [thet]\n+\n - When installing the default profile, restrict uninstalling of old types to\n   old FTI based ones.\n   [thet]\ndiff --git a/plone/app/contenttypes/browser/link_redirect_view.py b/plone/app/contenttypes/browser/link_redirect_view.py\nindex 4e4a45d..0bd5ae8 100644\n--- a/plone/app/contenttypes/browser/link_redirect_view.py\n+++ b/plone/app/contenttypes/browser/link_redirect_view.py\n@@ -32,7 +32,8 @@ def __call__(self):\n \n     def absolute_target_url(self):\n         \"\"\"Compute the absolute target URL.\"\"\"\n-        if self.context.remoteUrl.startswith('.'):\n+        url = self.context.remoteUrl\n+        if url.startswith('.'):\n             # we just need to adapt ../relative/links, /absolute/ones work\n             # anyway -> this requires relative links to start with ./ or\n             # ../\n@@ -41,13 +42,17 @@ def absolute_target_url(self):\n             )\n             url = '/'.join([\n                 context_state.canonical_object_url(),\n-                self.context.remoteUrl\n+                url\n             ])\n+        elif url.startswith('mailto:')\\\n+                or url.startswith('tel:')\\\n+                or url.startswith('callto:')\\\n+                or url.startswith('file:')\\\n+                or url.startswith('#'):\n+            # Do nothing for html/html5 links\n+            pass\n         else:\n-            url = replace_link_variables_by_paths(\n-                self.context,\n-                self.context.remoteUrl\n-            )\n+            url = replace_link_variables_by_paths(self.context, url)\n             if not (url.startswith('http://') or url.startswith('https://')):\n                 url = self.request.physicalPathToURL(url)\n \ndiff --git a/plone/app/contenttypes/tests/test_link.py b/plone/app/contenttypes/tests/test_link.py\nindex 88d5b45..144069c 100644\n--- a/plone/app/contenttypes/tests/test_link.py\n+++ b/plone/app/contenttypes/tests/test_link.py\n@@ -162,6 +162,30 @@ def test_link_redirect_view_path_with_variable(self):\n         self.assertTrue(view())\n         self._assert_redirect('http://nohost/plone/my-folder/my-item')\n \n+    def test_mailto_type(self):\n+        self.link.remoteUrl = 'mailto:stress@test.us'\n+        view = self._get_link_redirect_view(self.link)\n+        rendered = view()\n+        self.assertTrue('href=\"mailto:stress@test.us\"' in rendered)\n+\n+    def test_tel_type(self):\n+        self.link.remoteUrl = 'tel:123'\n+        view = self._get_link_redirect_view(self.link)\n+        rendered = view()\n+        self.assertTrue('href=\"tel:123\"' in rendered)\n+\n+    def test_callto_type(self):\n+        self.link.remoteUrl = 'callto:123'\n+        view = self._get_link_redirect_view(self.link)\n+        rendered = view()\n+        self.assertTrue('href=\"callto:123\"' in rendered)\n+\n+    def test_file_type(self):\n+        self.link.remoteUrl = 'file:///tmp'\n+        view = self._get_link_redirect_view(self.link)\n+        rendered = view()\n+        self.assertTrue('href=\"file:///tmp\"' in rendered)\n+\n     def _publish(self, obj):\n         portal_workflow = getToolByName(self.portal, \"portal_workflow\")\n         portal_workflow.doActionFor(obj, 'publish')","distinct":true,"url":"https://api.github.com/repos/plone/buildout.coredev/commits/16b4df199fa538071e6c2174cc5a3efd6c8ad657"}]}