Page MenuHomePhabricator

Links to file redirect pages do not have the mw-redirect class
Closed, ResolvedPublic

Description

I notice that when including links to filepages (NOT including an image), these links do not have the mw-redirect class as other links to redirects do.

Example. On the english wikipedia try create a link to,
[[:File:AFProsperity.jpg]], which redirects to [[:File:AFProsperity.png]].


Version: unspecified
Severity: normal

Details

Reference
bz23204

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 11:05 PM
bzimport set Reference to bz23204.
bzimport added a subscriber: Unknown Object (MLST).

This is because for such file links, the deprecated makeKnownLinkObj is used, which automatically adds "noclasses" for link().

As a matter a fact, there are a lot of link helpers that add "noclasses"

Created attachment 7304
patch to mark redirected files as such

Links to files like this are checked with isAlwaysKnown by the parser. The redirect resolves, so the file is known. I'm not sure what the best method is to solve this.

1: Remove NS_FILE from the Title isAlwaysKnown() check
2: Change the makeKnownLinkHolder of the parser to use link() directly instead of makeKnownLinkObj, but without adding the "noclasses" option. See attached patch.

Attached:

Is this still the case in 1.18alpha (install a /trunk on your local machine or ask sites like TranslateWiki) ?

sumanah wrote:

Derk-Jan, could you check with the 1.18 beta that came out today?

sumanah wrote:

Derk-Jan: sorry for the wait in review. I encourage you to get a Git account

https://www.mediawiki.org/wiki/Git

to make it easier for you to submit changes to MediaWiki and to get them reviewed faster. Thanks!

(In reply to comment #5)

Derk-Jan: sorry for the wait in review. I encourage you to get a Git account

https://www.mediawiki.org/wiki/Git

to make it easier for you to submit changes to MediaWiki and to get them
reviewed faster. Thanks!

thedj had a svn account so he apparently can commit to git, too. Sometimes, people submit their patches to bug tracker if they are unsure about their viability, to get them pre-reviewed.