Page MenuHomePhabricator

Hardcoded URL schema for seeing source code in page is protected
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • You have a MediaWiki installation with default URL settings
  • You have a Mobile Frontend extension and a page protected from editing
  • An unprivileged or anonymous user opens the protected page and click on the 'edit' button

What happens?:

The user gets a notification This page is protected to prevent vandalism. [$1 View source] (1), where $1 is like <wiki url>/wiki/<page title>?action=edit (2)

After clicking on the link, the user is redirected to the 404 page.

What should have happened instead?:

The mentioned link should redirect the user to the URL created using the configured URL schema, which by default is index.php?title=<title> or index.php/<title> (3). The schema hard-coded in Mobile Frontend is an optional configuration (4) and doesn't need to be set or use the wiki directory.

Software version (skip for WMF-hosted wikis like Wikipedia):

  • MediaWiki 1.39.3
  • Mobile Frontend 2.4.0

Other information (browser name/version, screenshots, etc.):

  • You can test it on the website https://wiki.fnin.eu/index.php/Bartosz_Hernas - just open in the mobile version, click on edit, and then on the link in the popup. No sign-in required.
  • Incorrect behavior is linked under the (2). Maybe it can be fixed by using some of MediaWiki's JavaScript methods? I'm not certain.

Thank you!

Event Timeline

Jdlrobson subscribed.

Looks like https://github.com/wikimedia/mediawiki-extensions-MobileFrontend/blob/master/src/mobile.init/editor.js#L483 should be updated to use mw.util.getUrl to construct the link href.
Thanks for the report!

Change 989185 had a related patch set uploaded (by Func; author: Func):

[mediawiki/extensions/MobileFrontend@master] editor: Do not assume the site is under the /wiki/ path

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

Change 989185 merged by jenkins-bot:

[mediawiki/extensions/MobileFrontend@master] editor: Do not assume the site is under the /wiki/ path

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

Func claimed this task.