diff --git a/api/src/Storage/Merge.php b/api/src/Storage/Merge.php index cc87d4c55d..c3b3f6a2cd 100644 --- a/api/src/Storage/Merge.php +++ b/api/src/Storage/Merge.php @@ -376,7 +376,7 @@ abstract class Merge protected function get_all_links($app, $id, $prefix, &$content) { $array = array(); - $pattern = '@\$(link|links|attachments|links_attachments)\/?(title|href|link)?\/?([a-z]*)\$@'; + $pattern = '@\$(links_attachments|links|attachments|link)\/?(title|href|link)?\/?([a-z]*)\$@'; static $link_cache=null; $matches = null; if(preg_match_all($pattern, $content, $matches)) @@ -418,7 +418,8 @@ abstract class Merge $array[($prefix?$prefix.'/':'').$placeholder] = Api\Html::a_href(Api\Html::htmlspecialchars($title), $link); break; case 'links': - $array[($prefix?$prefix.'/':'').$placeholder] = $this->get_links($app, $id, '!'.Api\Link::VFS_APPNAME, array(),$matches[2][$i]); + $link_app = $matches[3][$i] ? $matches[3][$i] : '!'.Api\Link::VFS_APPNAME; + $array[($prefix?$prefix.'/':'').$placeholder] = $this->get_links($app, $id, $link_app, array(),$matches[2][$i]); break; case 'attachments': $array[($prefix?$prefix.'/':'').$placeholder] = $this->get_links($app, $id, Api\Link::VFS_APPNAME,array(),$matches[2][$i]);