Page MenuHomePhabricator

Parsoid content not compatible with `index.php?title=` URLs
Open, MediumPublic

Description

I vaguely recall this issue being well(?) known, but the Parsoid output requires a particular URL setup.

Given a URL of the form: http://localhost/.../mediawiki/index.php?title=Main_Page&variant=sr-ec (for instance) the legacy parser will generate full absolute URLs in its output, eg:

<a href="/.../mediawiki/index.php/Tricky_Question_Marks%3F/Subpath/Child" title="Tricky Question Marks?/Subpath/Child">Tricky Question Marks?/Subpath/Child</a>

however Parsoid generates relative URLs (./Foo) which resolve incorrectly when the base href is '/index.php' because the proper URL *should* be /index.php/Foo.

This is an issue when including Parsoid content on a page, as the base href for the entire page needs to match what Parsoid expects.

Related Objects

StatusSubtypeAssignedTask
StalledNone
In ProgressNone
OpenNone
OpenNone
OpenReleaseNone
OpenNone
OpenNone
OpenNone
OpenFeatureNone
OpenNone
Resolvedcscott
OpenNone
Opencscott
Open ssastry
Resolveddaniel
Resolvedcscott
Resolvedcscott
OpenNone
OpenNone

Event Timeline

Not that Parsoid will also append querystrings with delimiter to the end, like ?lang=de

the legacy parser will generate full absolute URLs in its output

See core's Title::getLocalURL()

I vaguely recall this issue being well(?) known, but the Parsoid output requires a particular URL setup.

There are some notes about this in T270219 and T261711.

It looks like this is more-or-less fixed in Parsoid (but see T350952) in so far as SiteConfig::relativeLinkPrefix() in core jumps through extreme hoops in order to generate a base href and a relativeUrlPrefix() which work even for wikis with ?title= URL setups. But this probably breaks VE (T270219) which still only looks for & strips the basic ./ prefix and gets confused when Parsoid generates hrefs with (for example) ./index.php?title= as the "relative link prefix" instead of ./.

Change 975081 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/core@master] [parsoid] Fix Parsoid relative links, take 2

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

Change 975081 abandoned by C. Scott Ananian:

[mediawiki/core@master] [parsoid] Fix Parsoid relative links, take 2

Reason:

Abandoned in favor of I60165a9946a35cfb42a78ed2f833c34570fefffc

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