diff --git a/_test/media_linktitle_conversion.test.php b/_test/media_linktitle_conversion.test.php index 683d573..050f9d7 100644 --- a/_test/media_linktitle_conversion.test.php +++ b/_test/media_linktitle_conversion.test.php @@ -19,6 +19,7 @@ public function setUp() { * [[test|{{dokuwiki.png}}]] * [[#test|{{dokuwiki.png?w=200}}]] * [[doku>test|{{dokuwiki.png?w=300}}]] + * [[test|{{https://www.dokuwiki.org/lib/tpl/dokuwiki/images/logo.png}}]] EOF , 'Test setup'); idx_addPage('wiki:included'); @@ -41,4 +42,9 @@ public function testInterWikiLinkTitleConversion() { $html = p_wiki_xhtml('test:include'); $this->assertContains('src="'.ml('wiki:dokuwiki.png', array('w' => '300')).'"', $html); } + + public function testExternalMediaNotConverted() { + $html = p_wiki_xhtml('test:include'); + $this->assertContains('src="'.ml('https://www.dokuwiki.org/lib/tpl/dokuwiki/images/logo.png').'"', $html); + } } \ No newline at end of file diff --git a/helper.php b/helper.php index 79bcdb8..ff4003b 100644 --- a/helper.php +++ b/helper.php @@ -308,7 +308,7 @@ function _convert_instructions(&$ins, $lvl, $page, $sect, $flags, $root_id, $inc for($i=0; $i<$num; $i++) { // adjust links with image titles - if (strpos($ins[$i][0], 'link') !== false && isset($ins[$i][1][1]) && is_array($ins[$i][1][1])) { + if (strpos($ins[$i][0], 'link') !== false && isset($ins[$i][1][1]) && is_array($ins[$i][1][1]) && $ins[$i][1][1]['type'] == 'internalmedia') { // resolve relative ids, but without cleaning in order to preserve the name $media_id = resolve_id($ns, $ins[$i][1][1]['src']); // make sure that after resolving the link again it will be the same link