Page MenuHomePhabricator

Special:CategoryTree shows wrong link to parent category that containing string that need percent-encoding
Closed, ResolvedPublic

Description

A encountered a bug in Special:CategoryTree of the CategoryTree extension. I write this report in English but I can't use English well.

Steps to Reproduce:

  1. Go to Special:CategoryTree and input category name that has parent category containing string that need percent-encoding (i.e. URL encoding). For example, "?title=特別:カテゴリツリー&target=人物" in jawiki.
  2. Click the "Show tree" button (in Japanese, "ツリーを表示").
  3. Click a link to parents category containing string need percent-encoding (in Japanese, it is right next to "上位カテゴリ". It is "人間".).

Actual Results:

Expected Results:

  • The page should show a category tree of "人間".

I read the HTML tags for this part. The link destination of href attribute of a a tag that link to parent category is %25E4%25BA%25BA%25E9%2596%2593. I tried to decode it, it became %E4%BA%BA%E9%96%93 (this string is the same as the category name shown when you click "Show tree" button). And I did again, %E4%BA%BA%E9%96%93 became 人間. So a reason of this bug is a link URL to parent category is encoded 2 times.

To fix this bug, consider removing ->getPartialURL() from this line in the source code.

Thank you.

Event Timeline

Yuukin0248 renamed this task from Special:CategoryTree shows wrong link to parent category containing string need percent-encoding to Special:CategoryTree shows wrong link to parent category that containing string that need percent-encoding.May 26 2020, 11:59 AM

To fix this bug, consider removing ->getPartialURL() from this line in the source code.

Hi @Yuukin0248, thanks for taking the time to report this and welcome to Wikimedia Phabricator. And also thanks for taking a look at the code!
You are very welcome to use developer access to submit the proposed code changes as a Git branch directly into Gerrit which makes it easier to review and provide feedback. If you don't want to set up Git/Gerrit, you can also use the Gerrit Patch Uploader. Thanks again!

Change 598957 had a related patch set uploaded (by Yuukin0248; owner: Yuukin256):
[mediawiki/extensions/CategoryTree@master] Fixed a bug that double percent-encoding on Special:CategoryTree

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

@Aklapper Thank you for your information. Based on your advice, I became a wikimedia developer and submitted suggestion for the code change. Does my suggestion method looks good?

Thanks for the patch! I just realized that CategoryTree is listed on https://www.mediawiki.org/wiki/Developers/Maintainers as having no maintainers, so I hope that someone will take a look and review. :-/

Fyi, at jawiki Yuukin0248 tested positive the same issue with zh, another double-byte language.

Change 598957 merged by jenkins-bot:
[mediawiki/extensions/CategoryTree@master] Fixed a bug that double percent-encoding on Special:CategoryTree

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

TheDJ assigned this task to Yuukin0248.

Change 636954 had a related patch set uploaded (by Paladox; owner: Yuukin256):
[mediawiki/extensions/CategoryTree@REL1_35] Fixed a bug that double percent-encoding on Special:CategoryTree

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

Change 636954 merged by jenkins-bot:
[mediawiki/extensions/CategoryTree@REL1_35] Fixed a bug that double percent-encoding on Special:CategoryTree

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