Interwiki links to other MediaWiki wikis in the same cluster don't encode section fragment
Closed, DuplicatePublic

Description

The PHP parser (for enwiki config) parses:

[[mw:Flow#What happens to my custom signature?]]

as:

<a href="//www.mediawiki.org/wiki/Flow#What_happens_to_my_custom_signature.3F" class="extiw" title="mw:Flow">mw:Flow#What happens to my custom signature?</a>

See https://en.wikipedia.org/w/index.php?title=User:Mattflaschen_(WMF)/Sandbox&oldid=654710957

Parsoid (verified using form which also uses enwiki config) parses it as:

<a rel="mw:ExtLink" href="//www.mediawiki.org/wiki/Flow#What happens to my custom signature?" title="mw:Flow" data-parsoid="{&quot;stx&quot;:&quot;simple&quot;,&quot;a&quot;:{&quot;href&quot;:&quot;//www.mediawiki.org/wiki/Flow#What happens to my custom signature?&quot;},&quot;sa&quot;:{&quot;href&quot;:&quot;mw:Flow#What happens to my custom signature?&quot;},&quot;isIW&quot;:true,&quot;dsr&quot;:[0,48,2,2]}">mw:Flow#What happens to my custom signature?</a>

The interwiki table has an iw_local local field which I suspect is involved here (since the section encoding is just the standard encoding you would get if it were not an interwiki link).

The result is that you don't end up at the right section, but rather at the top of the page.

Original report below:


The anchor of this link is not generated correctly:
https://pt.wikipedia.org/w/index.php?title=T%C3%B3pico:Segov5w2cbzfrzck&topic_showPostId=seq389fse5fxehcx#flow-post-seq389fse5fxehcx

It points to
https://www.mediawiki.org/wiki/Flow#What%20happens%20to%20my%20custom%20signature?
but it should point to
https://www.mediawiki.org/wiki/Flow#What_happens_to_my_custom_signature.3F

He7d3r created this task.Apr 3 2015, 12:29 AM
He7d3r updated the task description. (Show Details)
He7d3r raised the priority of this task from to Needs Triage.
He7d3r added a subscriber: He7d3r.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptApr 3 2015, 12:29 AM

Please post the full wikitext as well.

He7d3r added a comment.Apr 3 2015, 1:06 AM

The wikitext for the link was [[mw:Flow#What happens to my custom signature?]]. However, Flow mangled the wikitext of the comment with a few tabs (T93851).

Mattflaschen-WMF renamed this task from Flow breaks links by encoding spaces as %20 instead of _ in their anchors to Interwiki links to other MediaWiki wikis in the same cluster don't encode section fragment.Apr 3 2015, 1:27 AM
Mattflaschen-WMF updated the task description. (Show Details)
Mattflaschen-WMF added a project: Parsoid.
Mattflaschen-WMF updated the task description. (Show Details)
Mattflaschen-WMF updated the task description. (Show Details)

This happens also when converting links from LQT, right?

It's a Parsoid issue, so it will happen anytime Parsoid converts wikitext to HTML (this includes LQT -> Flow conversion).

Arlolra triaged this task as Normal priority.Jul 20 2015, 9:20 PM
Arlolra claimed this task.
Arlolra added a subscriber: Arlolra.

Change 226032 had a related patch set uploaded (by Arlolra):
Sanitize link fragments

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

Arlolra removed Arlolra as the assignee of this task.Oct 16 2015, 3:50 PM
Arlolra removed a project: Patch-For-Review.

Change 324564 had a related patch set uploaded (by Arlolra):
Munge link fragments and element ids as in the php parser

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

Change 324564 merged by jenkins-bot:
Munge link fragments and element ids as in the php parser

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

Arlolra closed this task as Resolved.Dec 7 2016, 10:12 PM
Arlolra claimed this task.

Current output for echo "[[mw:Flow#What happens to my custom signature?]]" | node bin/parse is,

<a rel="mw:ExtLink" href="//www.mediawiki.org/wiki/Flow#What_happens_to_my_custom_signature.3F" title="mw:Flow" data-parsoid='{"stx":"simple","a":{"href":"//www.mediawiki.org/wiki/Flow#What_happens_to_my_custom_signature.3F"},"sa":{"href":"mw:Flow#What happens to my custom signature?"},"isIW":true}'>mw:Flow#What happens to my custom signature?</a>

ie. http://www.mediawiki.org/wiki/Flow#What_happens_to_my_custom_signature.3F