Page MenuHomePhabricator

Restore fragment in broken links
Open, LowPublic

Description

At some point, MW started stripping the URL's fragment of broken links (= red links); as a result, a link to a non-existent [[asdf#fragment]] target title and the specified section would render as /w/index.php?title=asdf&action=edit&redlink=1 (note that the section is omitted). However, some JS scripts could still take advantage of that currently missing #fragment bit. This is the case of a plwiktionary's popular gadget, running since 2011: one of its features consisted in generating a customized edit form for a new language section, according to the specified fragment of a link pointing to a missing title. We noticed that this used to work some time ago, hence the Regression tag.

Event Timeline

PeterBowman raised the priority of this task from to Needs Triage.
PeterBowman updated the task description. (Show Details)
PeterBowman added a subscriber: PeterBowman.
Restricted Application added subscribers: StudiesWorld, Aklapper. · View Herald TranscriptDec 19 2015, 6:47 PM
PeterBowman added a comment.EditedDec 19 2015, 6:53 PM

Possibly related code in Linker.php:

private static function linkUrl( $target, $query, $options ) {
    # We don't want to include fragments for broken links, because they
    # generally make no sense.
    if ( in_array( 'broken', $options ) && $target->hasFragment() ) {
        $target = clone $target;
        $target->setFragment( '' );
    }

    ...
Aklapper triaged this task as Low priority.Feb 16 2016, 3:11 PM