Page MenuHomePhabricator

Unresolved resource attribute in Parsoid readview
Closed, ResolvedPublic

Description

From https://gerrit.wikimedia.org/r/c/mediawiki/extensions/TimedMediaHandler/+/977278/1#message-e4075b1d12fc16f252c2702acdc8aa400ba63353

Parsoid had traditionally emitted links relative to a base element in the head of the document <base href="//en.wikipedia.org/wiki/"/>. In read views, those are resolved,

<a rel="mw:WikiLink" href="//en.wikipedia.org/wiki/Help:Introduction_to_images_with_Wiki_Markup/1" class="mw-selflink selflink">...

but the resource attribute is left relative,

<img alt="Page semi-protected" resource="./File:Semi-protection-shackle.svg" ...

which is an issue on subpages.

It looks like the |link= media options is also affected,

<span typeof="mw:File" data-parsoid='{"optList":[...{"ck":"link","ak":"link=Wikipedia:Protection policy#semi"},...]}' data-mw='{"caption":"This page is semi-protected."}'><a href="./Wikipedia:Protection_policy#semi" title="This page is semi-protected." data-parsoid="{}">

Examples are from https://en.wikipedia.org/wiki/Help:Introduction_to_images_with_Wiki_Markup/1?useparsoid=1

Event Timeline

mw:WikiLinks were handled in T350952

It looks like the |link= media options is also affected,

That's surprising, given how it's implemented,
https://github.com/wikimedia/mediawiki/blob/master/includes/OutputTransform/Stages/ExtractBody.php#L36-L37

The issue is that the image is in a <div id="mw-indicator-pp-default" class="mw-indicator"> from an <indicator> extension and is equally true of mw:WikiLinks.

Change 1003540 had a related patch set uploaded (by Arlolra; author: Arlolra):

[mediawiki/core@master] [WIP] Resolve relative resource attributes as well

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

Change 1003562 had a related patch set uploaded (by Arlolra; author: Arlolra):

[mediawiki/core@master] [WIP] Apply relative attr expansion to indicators

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

Change 1003540 merged by jenkins-bot:

[mediawiki/core@master] Resolve relative resource attributes as well

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

Change 1003562 merged by jenkins-bot:

[mediawiki/core@master] Apply relative attr expansion to indicators

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

Arlolra subscribed.

Examples are from https://en.wikipedia.org/wiki/Help:Introduction_to_images_with_Wiki_Markup/1?useparsoid=1

Post-deploy,

<img alt="Page semi-protected" resource="//en.wikipedia.org/wiki/File:Semi-protection-shackle.svg" ...