Page MenuHomePhabricator

Wikidata links to geojson in Commons redirect incorrectly if there is a space in the file name
Open, Needs TriagePublic

Description

Currently if you query Wikidata with sparql for the geoshape of a country who's name contains a space you get a broken link.

For example try running a query for North Korea:

SELECT * WHERE {
  wd:Q423 wdt:P3896 ?label 
}

You will get the link "http://commons.wikimedia.org/data/main/Data:North+Korea.map".

If you follow this link you get:

  1. A 301 moved permanently redirect to "https://commons.wikimedia.org/wiki/Special:PageData/main/Data:North+Korea.map"
  2. A 303 see other redirect to "https://commons.wikimedia.org/w/index.php?title=Data:North%2BKorea.map&action=raw"
  3. A 404 not found for the final page

If you correct the last redirect by replacing the %2B with a + producing the link "https://commons.wikimedia.org/w/index.php?title=Data:North+Korea.map&action=raw" the page does load.

This issue appears to occur more generally with geoshapes of countries with spaces in their names. For example the United States, the United Kingdom, and Saudi Arabia