Page MenuHomePhabricator

Mapframe maps with an image in the GeoJSON don't display on mobile website or mobile apps
Closed, ResolvedPublic

Description

Mapframe maps that include images in the GeoJSON code don't display on the mobile website or the Android app or the iOS app. E.g., here is a page that compares a map that includes an image versus one that has no image. (The one with the image doesn't display on any mobile platform; the one without displays properly on the mobile website but not on the apps, an issue detailed in T193313.)

[desktop link] https://en.wikipedia.org/wiki/User:JMatazzoni_(WMF)/maptest
[mobile link] https://en.m.wikipedia.org/wiki/User:JMatazzoni_(WMF)/maptest

for testing purposes, the same maps are on test2, which displays dynamic maps right on the page (instead of static maps, like most Wikipedias), and on ca.wiki, which should be the same as en.wiki but we're just making sure.
[test2] https://test2.wikipedia.org/wiki/User:JMatazzoni_(WMF)/maptest
[ca.wik] https://ca.wikipedia.org/wiki/Usuari:JMatazzoni_(WMF)/maptest

For the mobile website I was able to see that the issue is that the request to maps.wikimedia.org returns a 400 Bad Request.

This is the request done on the desktop website that works fine:

https://maps.wikimedia.org/img/osm-intl,14,-33.92151,18.4213328,400x250.png?lang=en&domain=en.wikipedia.org&title=User%3AJMatazzoni+%28WMF%29%2Fmaptest&groups=_cfd0a90b704aff0ccc1e22cc6f3d7b05a1075ea1

While the mobile website uses a different group ID, while keeping the same domain en.wikipedia.org:

https://maps.wikimedia.org/img/osm-intl,14,-33.92151,18.4213328,400x250.png?lang=en&domain=en.wikipedia.org&title=User%3AJMatazzoni+%28WMF%29%2Fmaptest&groups=_23d973ffe007348f605b87c5808ecf9ed87356f9

That results in a 400 with body:

"GroupId not available"

Event Timeline

Volans created this task.May 1 2018, 9:04 AM
Restricted Application added a project: Discovery. · View Herald TranscriptMay 1 2018, 9:04 AM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Jdlrobson moved this task from Needs triage to Triaged on the Mobile board.May 3 2018, 9:49 PM

To keep everyone in the loop, I've chat with @Catrope the other day about this and we debugged it a bit together.

The root cause seems to be the way the hashes are calculated. In the example page I've linked above, the JSON for the mapframe includes a wiki link. It seems that the hashes are calculated after the link is resolved, including its variant (mobile vs desktop), so basically a mapframe that contains links will work properly only if viewed from the same variant where it was saved.

To repro it we've made a simple edit to that page and now the mobile version works while the desktop one doesn't.
I'm not familiar with the relative code so I don't know how hard could it be to calculate the hash before the link resolution. My understanding is that @Catrope is working on some changes that might help to fix this issue too, but I'll leave it to him to explain that part.

The root cause seems to be the way the hashes are calculated. In the example page I've linked above, the JSON for the mapframe includes a wiki link. It seems that the hashes are calculated after the link is resolved, including its variant (mobile vs desktop), so basically a mapframe that contains links will work properly only if viewed from the same variant where it was saved.

It turns out I was slightly wrong here: the variance doesn't come from the link target, but from the image having an srcset attribute on desktop that is absent on mobile.

This comment was removed by jmatazzoni.
Catrope added a comment.EditedJun 6 2018, 4:57 PM

Sorry, T193313 is not fully a duplicate, but it is related

jmatazzoni renamed this task from Mapframe not loaded on mobile website and iOS/Android apps to Mapframe maps with an image in the GeoJSON don't display on mobile website or mobile apps .Jun 7 2018, 12:35 AM
jmatazzoni updated the task description. (Show Details)
jmatazzoni added a subscriber: ovasileva.
JTannerWMF closed this task as Resolved.Jun 26 2018, 5:46 PM
JTannerWMF claimed this task.
Vvjjkkii renamed this task from Mapframe maps with an image in the GeoJSON don't display on mobile website or mobile apps to 5wdaaaaaaa.Jul 1 2018, 1:12 AM
Vvjjkkii reopened this task as Open.
Vvjjkkii removed JTannerWMF as the assignee of this task.
Vvjjkkii triaged this task as High priority.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii edited subscribers, added: JTannerWMF; removed: Aklapper.
CommunityTechBot renamed this task from 5wdaaaaaaa to Mapframe maps with an image in the GeoJSON don't display on mobile website or mobile apps .Jul 1 2018, 1:54 PM
CommunityTechBot closed this task as Resolved.
CommunityTechBot assigned this task to JTannerWMF.
CommunityTechBot updated the task description. (Show Details)
CommunityTechBot edited subscribers, added: Aklapper; removed: JTannerWMF.
CommunityTechBot raised the priority of this task from High to Needs Triage.Jul 3 2018, 1:53 AM