Page MenuHomePhabricator

Wrong hyperlink in link dialog in VisualEditor
Closed, ResolvedPublicBUG REPORT


Preliminary info: Site address is; Format of wiki pages (including files) is

Steps to Reproduce:

  • Create or find an article with a file link in it (e.g, [[:File:West-walk-3.jpg|File:West-walk-3.jpg]]
  • Edit the article with VisualEditor
  • Click on the file link; the corresponding dialog box opens
  • In the dialog box, when hovering over the file name, the link is shown as

Actual Results:
Clicking on the hyperlink in the dialog box goes to a dead link

Expected Results:
Should go to the actual file page

Note that a similar issue exists with Media links

Event Timeline

I think I accidentally wrote a patch that also fixes this issue a couple days ago:

Change 537757 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/VisualEditor@master] Fix linking to image files in media dialog/context

@ti_infotrad Can you elaborate on "Note that a similar issue exists with Media links"? My patch fixes the issue in these two places in the interface, and I'm not aware of any other problems.

image.png (548×1 px, 182 KB)

image.png (548×1 px, 165 KB)


  • Your fix is for media dialogs; the issue I described is for internal link dialogs (see screenshot below):

T233628_0.png (619×1 px, 97 KB)

I may be able to use your method to fix the related code, looking into it.

  • I am mentioning a similar issue because the internal link syntax
[[Media:file name]]

suffers from the same issue.

Oh right, duh. Sorry, I saw you write 'File:' and just completely missed the rest of your bug report.

OK so the change describe by the diff below seems to work, at least for me...
In file modules\ve-mw\ui\contextitemsve.ui.MWInternalLinkContextItem.js

 ve.ui.MWInternalLinkContextItem.static.generateBody = function ( linkCache, model, htmlDoc, context ) {
        var icon, $description,
                title = model.getAttribute( 'lookupTitle' ),
                description = model.getAttribute( 'normalizedTitle' ),
-               href = model.getHref(),
+               href = mw.config.get( 'wgArticlePath' ).replace( '$1', '' ) + title,
                fragment = model.getFragment(),
                usePageImages = mw.config.get( 'wgVisualEditor' ).usePageImages,
                usePageDescriptions = mw.config.get( 'wgVisualEditor' ).usePageDescriptions,

I added a fix for this case too to my patch.

Change 537757 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] Fix linking to pages in media dialog/media context/internal link context

Ryasmeen claimed this task.
Ryasmeen edited projects, added Verified; removed Editing QA.
Ryasmeen moved this task from QA to Product owner review on the VisualEditor (Current work) board.