I have an extension that produces a valid link using the Linker class, but this link causes VisualEditor to hang. This problem is new since we upgraded to MediaWiki 1.27 from 1.26.
The rendered HTML of the link is:
```
<a href="/w/index.php?title=Special:CodeView&path=http%3A%2F%2Fexample.com%2Ffoo&platform=bar" title="View this code" target="_blank">foo</a>
```
When VisualEditor tries to load on a page with this link, it throws an error about a null title:
```
TypeError: Cannot read property 'toText' of null(...)
```
Apparently, the function `ve.dm.MWInternalLinkAnnotation.static.getTargetDataFromHref` (in file `modules/ve-mw/dm/annotations/ve.dm.MWInternalLinkAnnotation.js`) is getting confused by this link. The function correctly detects that the link is internal (setting `isInternal = true`), but then it comes to the final test:
```
// The href is simply the title, unless we're dealing with a page that has slashes in its name
// in which case it's preceded by one or more instances of "./" or "../", so strip those
matches = href.match( /^((?:\.\.?\/)*)(.*)$/ );
return { title: matches[ 2 ], hrefPrefix: matches[ 1 ], isInternal: isInternal };
```
Here, the href is not "simply the title." As a result, `matches[2]` is set to null, causing the calling function (`ve.dm.MWInternalLinkAnnotation.static.newFromTitle`) to blow up on the first line:, because `title` is null.
```
var target = title.toText()
```
Here is the approximate PHP code we use to render the link, so you know it's kosher:
```
public function doRender() {
$title = SpecialPage::getTitleFor('CodeView');
$url = 'http://whatever...';
$attribs = array(
'target' => '_blank',
'title' => wfMessage( 'whatever' )->text(),
);
$query = array(
'path' => $url,
'platform' => 'whatever',n
);
return Linker::link( $title, $linkText, $attribs, $query );
}
Are we doing something wrong, or is the VisualEditor code not handling this link properly? Thank you.
```
Are we doing something wrong, or is the VisualEditor code not handling this link properly? Thank you.