Page MenuHomePhabricator

Editing a <mapframe> whose GeoJSON has a wikitext link in the title of a point dirty-diffs the link to an HTML link
Closed, ResolvedPublic

Description

  1. Edit https://www.mediawiki.org/wiki/Maps in VE
  2. Edit the map
  3. Observe that the GeoJSON has a single point, whose title is [https://www.mediawiki.org/w/index.php?title=Discovery Maps Team]
  4. Do something that changes the GeoJSON, e.g. add a new point to the map
  5. Observe that the title of the existing point has changed to <a class="external text" href="https://www.mediawiki.org/w/index.php?title=Discovery">Maps Team</a>
  6. Add another point to the map
  7. The title now changes to &lt;a class="external text" href="<a class="external free" href="https://www.mediawiki.org/w/index.php?title=Discovery">https://www.mediawiki.org/w/index.php?title=Discovery</a>"&gt;Maps Team&lt;/a&gt;
  8. If you try to save this, it'll (obviously) break

The same thing happens with other types of wikitext links, like [https://www.example.org Example] or [[Foo]].

Details

Related Gerrit Patches:

Event Timeline

Catrope created this task.Feb 13 2018, 7:10 PM
Restricted Application added a project: Discovery. · View Herald TranscriptFeb 13 2018, 7:10 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Catrope updated the task description. (Show Details)Feb 13 2018, 7:13 PM

From looking at the network traffic is looks like this happens inside api.php?action=sanitize-mapdata: the frontend makes a request to that API module with a GeoJSON blob containing wikitext, and it gets back a GeoJSON blob containing HTML.

MaxSem added a subscriber: MaxSem.Feb 13 2018, 7:22 PM

This API is supposed to be used for display only.

jmatazzoni triaged this task as Medium priority.Feb 27 2018, 12:02 AM

I think I understand what happens: the "sanitized" GeoJSON is used for display but not in the editor. This works fine as long as you change the GeoJSON in the editor. But when you use the visual tools, the GeoJSON is modified programmatically, and the starting point used for that is the "sanitized" version. The modified version of the "sanitized" GeoJSON is that put into the editor.

Change 418228 had a related patch set uploaded (by Catrope; owner: Catrope):
[mediawiki/extensions/Kartographer@master] Fix corruption of title/description wikitext to HTML when editing in VE

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

Change 418228 merged by jenkins-bot:
[mediawiki/extensions/Kartographer@master] Fix corruption of title/description wikitext to HTML when editing in VE

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

Etonkovidova closed this task as Resolved.Mar 14 2018, 12:19 PM
Etonkovidova added a subscriber: Etonkovidova.

Checked in testwiki (wmf.25) - the title/description is not changed by unrelated edits.

Restricted Application added a project: User-Ryasmeen. · View Herald TranscriptMar 14 2018, 12:19 PM