Page MenuHomePhabricator

jqueryMsg erroneously marks relative URLs as external
Open, Needs TriagePublic

Description

(original title: jQueryMsg should generate external links with 'external' CSS class)

This is for parity with the server, and there is at least one practical use case. GuidedTour uses this class to detect what kind of link it is for analytics/EventLogging purposes.

This task was later repurposed to track a bug in the implementation, described in comment T267464#6625790

Event Timeline

Mattflaschen-WMF renamed this task from jQueryMsg should generate external links with 'external' class to jQueryMsg should generate external links with 'external' CSS class.Sep 26 2017, 6:35 AM
JTannerWMF subscribed.

The Growth-Team is not working on Guided Tour tasks at this time.

Unable to locate

jQueryMsg

in any of the GuidedTours file

Can you elaborate please? How is your comment related to this task, and what are steps to reproduce what you added as a comment?

Edit: Argh. Sorry, I should read better.

extension.json defines a dependency on mediawiki.jqueryMsg.

Change 634753 had a related patch set uploaded (by He7d3r; owner: He7d3r):
[mediawiki/core@master] Add 'external' class to links generated by jQueryMsg

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

Change 634753 merged by jenkins-bot:
[mediawiki/core@master] Add 'external' class to links generated by jQueryMsg

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

Jdlrobson subscribed.

There seems to be a bug in the code here, as it identifies the URL '/w/index.php?title=Jane_Grigson&action=history'; as an external link which has led to T267464

I see an external class ~/git/core/resources/src/mediawiki.jqueryMsg/mediawiki.jqueryMsg.js

The issue is the line:

if ( target.search( 'new RegExp( '^(/|' + mw.config.get( 'wgUrlProtocols' ) + ')' )' ) !== -1 ) {
This will return 0 for relative URIs e.g.

'/w/index.php?title=Jane_Grigson&action=history'.search(new RegExp( '^(/|' + mw.config.get( 'wgUrlProtocols' ) + ')' ))
Pppery renamed this task from jQueryMsg should generate external links with 'external' CSS class to jqueryMsg erroneously marks relative URLs as external.Tue, May 14, 1:47 AM
Pppery updated the task description. (Show Details)