Page MenuHomePhabricator

Dirty diffs on Media: links on non-English wikis
Open, Needs TriagePublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Create a page on French Wikipedia (or any wiki that uses something else than "Media" for the "Media" namespace) with [[Media:Plop.png]]
  • Make a trivial/null edit on the page with VisualEditor

What happens?:

  • The link is transformed to [[Média:Plop.png]]

What should have happened instead?:

  • No dirty diff should happen on that link

Note

Issue raised on https://www.mediawiki.org/w/index.php?title=Topic:Xdix8k106l2jq38l

Event Timeline

As far as I can tell, this stems from a difference introduced by VE. The content coming from Parsoid reads like this:

<<body id="mwAA" lang="fr" class="mw-content-ltr sitedir-ltr ltr mw-body-content parsoid-body mediawiki mw-parser-output" dir="ltr" data-parsoid='{"dsr":[0,14,0,0]}'><p id="mwAg" data-parsoid='{"dsr":[0,14,0,0]}'><a rel="mw:MediaLink" href="./Special:FilePath/Plop" resource="./Média:Plop" title="Plop" typeof="mw:Error" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}' id="mwAw" data-parsoid='{"stx":"simple","a":{"resource":"./Média:Plop"},"sa":{"resource":"Media:Plop"},"dsr":[0,14,2,2]}'>Media:Plop</a></p></body>

The content before save in VE reads like this:

<body id="mwAA" lang="fr" class="mw-content-ltr sitedir-ltr ltr mw-body-content parsoid-body mediawiki mw-parser-output" dir="ltr" data-parsoid='{"dsr":[0,14,0,0]}'><p id="mwAg" data-parsoid='{"dsr":[0,14,0,0]}'><a href="./Média:Plop" rel="mw:WikiLink" resource="./Média:Plop" title="Plop" typeof="mw:Error" id="mwAw" data-parsoid='{"stx":"simple","a":{"resource":"./Média:Plop"},"sa":{"resource":"Media:Plop"},"dsr":[0,14,2,2]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'>Media:Plop</a></p></body>

Note in particular the transformation from "MediaLink" to "WikiLink", which in turns makes DOMDiff detect a wrapper change, which regenerates the link - with the "local" namespace prefix. Not sure whose fix that one is :)

ihurbain updated the task description. (Show Details)
ihurbain updated the task description. (Show Details)

It might be worth checking if Parsoid will not dirty if you run selser with VE's HTML as your new.html but where you update the mw:WikiLink back to mw:MediaLink. If that doesn't get dirtied, it would indicate that a fix in VE would fix the problem. If not, we probably have things to find in both Parsoid and VE.

Indeed, updating back to mw:MediaLink seems to be enough for Parsoid to not have a dirty-diff there. It still displays a "modified-wrapper", but it round-trips without the accent as expected.

Okay, moving this to Tracking on the Parsoid board.