Page MenuHomePhabricator

Wrong hyperlink in link dialog in VisualEditor
Closed, ResolvedPublicBUG REPORT

Description

Preliminary info: Site address is http://10.21.37.105; Format of wiki pages (including files) is http://10.21.37.105/index.php?title=Main_Page

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 http://10.21.37.105/File:West-walk-3.jpg

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

Expected Results:
Should go to the actual file page http://10.21.37.105/index.php?title=File:West-walk-3.jpg

Note that a similar issue exists with Media links

Event Timeline

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

https://gerrit.wikimedia.org/r/537757

@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)

@matmarex

  • 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

https://gerrit.wikimedia.org/r/537757

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.