Page MenuHomePhabricator

mobile-html: title should be encoded to call the /page/related API
Closed, ResolvedPublicBUG REPORT

Description

Steps to Reproduce:

  1. Search /dev/random in Wikipedia Android app
  2. Go to the bottom of the page to see if the related pages being loaded.

Actual Results:

Not showing related pages

Expected Results:

Showing related pages

Note

By checking the log, I have found the title did not encoded correctly, which will cause a "title not found" error.
https://en.wikipedia.org/api/rest_v1/page/related//dev/random
and it should be:
https://en.wikipedia.org/api/rest_v1/page/related/%2Fdev%2Frandom

Event Timeline

This is because when the Android app calls pcs.c1.Footer.add() it doesn't percent-encode the title. I've created a PR[1] to show what should happen.

I wonder if it would be easier to just remove these parameters (title and baseURL) and just have the JS code get them from document.location.pathname to avoid this confusion.
You can see this in action when adding the footer=true query param: https://en.wikipedia.org/api/rest_v1/page/mobile-html/%2Fdev%2Frandom?footer=true.

[1] https://github.com/wikimedia/apps-android-wikipedia/pull/1344

Change 607893 had a related patch set uploaded (by BearND; owner: BearND):
[mediawiki/services/mobileapps@master] Hygiene: document that title must be encoded

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

Change 607893 merged by jenkins-bot:
[mediawiki/services/mobileapps@master] Hygiene: document that title must be encoded

https://gerrit.wikimedia.org/r/c/mediawiki/services/mobileapps/ /607893

This should be fixed client-side by the Android app.

Update: Just noticed the comments on my Android app patch that this is more complicated on the client side. How about we change the PCS JS to ignore the title that is set by the client and figure it out from window.location?

Change 610114 had a related patch set uploaded (by BearND; owner: BearND):
[mediawiki/services/mobileapps@master] Footer.add: remove title param

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

@cooltey @Dbrant @JoeWalsh What do you think about my proposal (see patch above) to remove the title parameter from Footer.add()? Is there a real need for the client to specify the title at all? Just checking to make sure this approach makes sense.

Change 610114 merged by jenkins-bot:
[mediawiki/services/mobileapps@master] Footer.add: remove title param

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