Page MenuHomePhabricator

Parsoid content not compatible with `index.php?title=` URLs
Closed, ResolvedPublic

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.

Details

Related Objects

StatusSubtypeAssignedTask
StalledNone
OpenNone
ResolvedMSantos
ResolvedMSantos
OpenReleaseNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenFeatureNone
OpenNone
Resolvedcscott
OpenNone
Opencscott
Resolvedssastry
Resolveddaniel
Resolvedcscott
Resolvedcscott
OpenNone
Resolvedihurbain

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.

ssastry triaged this task as Medium priority.Jun 14 2022, 10:29 PM

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

ihurbain claimed this task.
ihurbain subscribed.

Marking as resolved - I don't remember running into that kind of issue in recent memory, and T350952 (referred by the patch in favor of which the initial patch of this ticket has been abandoned) is closed. Feel free to re-open if that was not the right call.