Page MenuHomePhabricator

Unable to change content model to Map.Json
Open, Needs TriagePublic

Description

Background: https://en.wikipedia.org/wiki/Template_talk:Infobox_road#Map_data_on_Commons
Steps to reproduce

  1. On Commons, create a page with 'wikitext' as the content model (e.g. in Commons: namespace), but with valid JSON syntax for a .map data page
  2. Move the page to the Data: namespace, with a pagename that ends in .map
  3. Attempt to change the content model to json/map.json

Actual result

  • Fails with the error "Invalid content data". Viewing the resulting data (in both wikitext and plain text model) shows a "Fatal exception of type "Exception" error.
  • Note that attempting to change the content model before doing a page move does not work either.

Expected result

  • The page content model will be changed

Work around
A method of working around this bug is (after moving the page to the Data: namespace with a .map page name)

  1. delete the page
  2. recreate the page using the editor (pasting in the JSON from the deleted page)
  3. restore the deleted revisions

which was used on https://commons.wikimedia.org/wiki/Data:Highway_192_in_Iowa_(3).map. But the process shouldn't need to be this complicated.

Event Timeline

Actually the "Invalid content data" error only occurred if you moved the imported content to the Data namespace when the data did not comply with map.json requirements. Fixing the content to comply with map.json, moving it to Data namespace, and then trying to set the content model to map.json also did not not work (the closest option offered by Special:ChangeContentModel was JSON). Setting the content model of the valid ".map" content to the JSON content model (either before or after the move) does not result in a functional map. For an example of this see https://commons.wikimedia.org/wiki/Data:Highway_192_in_Iowa_(2).map