Page MenuHomePhabricator

VisualEditor breaks templates/parser functions in Media links
Open, Needs TriagePublic

Description

  1. Upload a file named Example.jpg
  2. Create a page named Example with [[Media:{{PAGENAME}}.jpg]]
  3. Edit Example with the VisualEditor, add a space and click save the edits.

Expected outcome:
The source still contains [[Media:{{PAGENAME}}.jpg]].

Observed outcome:
The source contains [//localhost:1352/wiki/images/a/a9/Example.jpg Media:Example.jpg] instead.

Note that there are real use cases for using templates or parser functions in Media links, case in point the {{FILEPREFIX}} parser function of my Attachments extension.

Event Timeline

Are you using the latest versions of VisualEditor and Parsoid? I recall similar issues but they have been fixed a while ago (e.g. T198511). I couldn't reproduce this problem locally.

Yes I am using MediaWiki 1.35.2 with the bundled VisualEditor & Parsoid. I should add that the Media: link being turned into an external link is immediately apparent when opening the VIsualEditor.