Page MenuHomePhabricator

mobile-html: Error previewing edits for pages with slashes in the title in the Android app
Open, HighPublic

Description

A Hebrew Wikipedia user complained that he cannot edit pages in the user space using the app.

I can reproduce it in 2.7.50320-r-2020-05-20:

  • Open the Android app in the Hebrew Wikipedia.
  • Open the page משתמש:MathKnight/סקורפיון (מורטל קומבט) (link)
  • Edit.
  • Change one letter.
  • Save.

When I look at the diff, I see this:

{"type":"https://mediawiki.org/wiki/HyperSwitch/errors/not_found","title":"Not found.","method":"post","uri":"/he.wikipedia.org/v1/transform/wikitext/to/mobile-html/%D7%9E%D7%A9%D7%AA%D7%9E%D7%A9%3AMathKnight%2F%D7%A1%D7%A7%D7%95%D7%A8%D7%A4%D7%99%D7%95%D7%9F_(%D7%9E%D7%95%D7%A8%D7%98%D7%9C_%D7%A7%D7%95%D7%9E%D7%91%D7%98)"}

When I try to publish, I see an AbuseFilter error.

When I try to do the same on the desktop, with the same account, everything works.

Event Timeline

Amire80 created this task.May 24 2020, 5:10 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript

@bearND @Mholloway
I can reproduce this issue if the title contains a /.

Not sure if we should handle the / before sending the title to the API. For now, it will be encoded to %2F. (For example: User:Cooltey/AndroidNote => User%3ACooltey%2FAndroidNote)

Article like this: https://en.wikipedia.org/wiki//e/_(operating_system) will have the same issue.

Mholloway added a comment.EditedJun 16 2020, 2:16 PM

Yes, page titles used as URL components should be URL-encoded before sending to any RESTBase (api/rest_v1/) API, otherwise you will see this problem.

It looks like this may already be fixed: https://github.com/wikimedia/apps-android-wikipedia/commit/a5b741ef5b00b4cbd09489e0c5cd48ccb972c82c

Mholloway added a comment.EditedJun 16 2020, 3:35 PM

@cooltey did some more investigation, and it looks like this is actually a bug in the PCS /transform/wikitext/to/mobile-html code.

Compare

https://en.wikipedia.org/api/rest_v1/page/summary/%2Fdev%2Frandom

with

https://en.wikipedia.org/api/rest_v1/transform/wikitext/to/mobile-html/%2Fdev%2Frandom

My guess off the top of my head is that we're attempting to fetch wikitext from the Action API without accounting for title encoding.

Thanks @Mholloway.

Move this ticket to Blocked/Waiting to wait for the bug to be fixed by the Product Infrastructure team.

LGoto raised the priority of this task from Low to Medium.Jun 24 2020, 3:53 PM
LGoto moved this task from Needs triage to Upcoming on the Product-Infrastructure-Team-Backlog board.
JoeWalsh renamed this task from Error editing a page in the user space using the Android Wikipedia app to mobile-html: Error previewing edits for pages with slashes in the title in the Android app.EditedJun 30 2020, 4:44 PM
JoeWalsh raised the priority of this task from Medium to High.
JoeWalsh added subscribers: Charlotte, JoeWalsh.

Bumping priority to high and moving on to the kanban board based on conversation with @Charlotte and the Android team

MSantos claimed this task.Jul 2 2020, 3:29 PM
MSantos moved this task from To Do to Doing on the Product-Infrastructure-Team-Backlog (Kanban) board.
eprodromou added a subscriber: eprodromou.

OK, retag us when the PR for Restbase is ready for review.

Hey @Mholloway and @MSantos - what's the status here? Do you still need @eprodromou's folks to review anything for you at this point?

Hey @Mholloway and @MSantos - what's the status here? Do you still need @eprodromou's folks to review anything for you at this point?

I'll double-check, but the related code is already merged, thanks for pinging us.