Skip to content

Commit

Permalink
Added a test for mailto: links
Browse files Browse the repository at this point in the history
  • Loading branch information
onigoetz committed Jan 23, 2017
1 parent 77541b6 commit 2b1bfbf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion libs/ContentTypes/Markdown/LinkRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ protected function isValidUrl($url)

protected function isExternalUrl($url)
{
return preg_match('|^(?:[a-z]+:)?//|', $url) || substr($url, 0, 7) == "mailto:";
return preg_match('#^(?:[a-z]+:)?//|^mailto:#', $url);
}

/**
Expand Down
3 changes: 3 additions & 0 deletions tests/ContentTypes/Markdown/LinkRendererTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ public function providerRenderLink()
// /Content/Page
['<a href="../Widgets/Button.html">Link</a>', '[Link](../Widgets/Button.md)', 'Content/Page.html'],
['<a href="../Widgets/Button.html">Link</a>', '[Link](!Widgets/Button)', 'Content/Page.html'],

// Mailto links
['<a href="mailto:[email protected]" class="external">[email protected]</a>', '[[email protected]](mailto:[email protected])', 'Content/Page.html'],
];
}

Expand Down

0 comments on commit 2b1bfbf

Please sign in to comment.