Page MenuHomePhabricator

Wikisource Extension: URL encode page title in sidebar links
Closed, ResolvedPublic1 Estimated Story PointsBUG REPORT

Description

What is the problem?

Trying to use the sidebar links to export https://en.wikisource.org/wiki/The_Satires,_Epistles_%26_Art_of_Poetry_of_Horace returns: Page not found for: The_Satires,_Epistles_.

The link's href is https://wsexport.wmflabs.org/?format=epub-3&lang=en&page=The_Satires,_Epistles_&_Art_of_Poetry_of_Horace. The & should be %26.

I guess the same would go for other reserved characters.

Steps to reproduce problem
  1. Go to https://en.wikisource.org/wiki/The_Satires,_Epistles_%26_Art_of_Poetry_of_Horace
  2. In the left sidebar click "Download EPUB"

Expected behavior: Ebook downloads.
Observed behavior: Error message.

Environment

Wiki(s): Wikisource โ€“ (0c0e97a) 07:36, 11 January 2021.

Event Timeline

Restricted Application added a subscriber: Aklapper. ยท View Herald TranscriptJan 14 2021, 3:04 PM

Change 656279 had a related patch set uploaded (by Samwilson; owner: Samwilson):
[mediawiki/extensions/Wikisource@master] URL encode page titles in WS Export links

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

This is ready for review. I noticed also that the work for T256345 doesn't remove underscores from page names, so I'll fix that up.

The other thing that the sidebar links weren't including was the namespace. This is necessary for wikis that have other works namespaces such as 'Translate' etc. I've updated the above patch.

Change 656279 merged by jenkins-bot:
[mediawiki/extensions/Wikisource@master] URL encode page titles in WS Export links

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

I can now use the sidebar links on https://en.wikisource.org/wiki/The_Satires,_Epistles_%26_Art_of_Poetry_of_Horace to correctly export.

As an extreme example, I can also use the links on https://en.wikisource.beta.wmflabs.org/wiki/Foo_!$%25%26%27()*%2B,/:;%3D%3F@_Bar.

Also, the links work for pages in non-Main namespaces (i.e. they include the correct namespace). I tested on the Author, Index, Page, Translation namespaces.

This change has gone to production.

Test Environments:

ifried added a subscriber: ifried.

This is now on production, and I am no longer able to reproduce the bug. When I try to download the EPUB, it downloads as expected. For these reasons, O'm marking this ticket as Done.