Menu

#99 RedirectsTo function can return an html-encoded page title

closed-invalid
nobody
None
2015-04-08
2013-12-13
Luke
No

Imagine a wiki page with this title: Nuts & Bolts

A separate page can be redirected to that page with this syntax:
#REDIRECT [[Nuts %26 Bolts]]

This all works fine from the wiki perspective. However, when the RedirectsTo() function is executed on that redirect page, it returns "Nuts %26 Bolts". That is not a valid page title which breaks other things including the ResolveRedirect() function (because it tries to load the encoded page title which gets re-encoded and ends up with a 400 error).

I've experienced this on version 2.103. The code in 3.00 looks to have the same problem.

Suggest that RedirectsTo() should utilize HttpUtility.HtmlDecode() on the return value.

Discussion

  • Luke

    Luke - 2013-12-13

    Actually, HttpUtility.UrlDecode rather than HttpUtility.HtmlDecode.

     
  • CodeDriller

    CodeDriller - 2013-12-14

    Why would anyone use %26 instead of a & sign?

    And I can't find any note in MediaWiki docs saying that this syntax is officially supported.

     
  • Luke

    Luke - 2013-12-14

    My suspicion is that a user copy/pasted the redirected-to page name out of their web browser address bar when entering the REDIRECT syntax. I have a few examples of this where the redirected-to page name is quite long, so it's feasible that the user would copy/paste rather than typing the entire name.

     
  • CodeDriller

    CodeDriller - 2015-01-24

    UrlDecode() will convert plus sign into space. And some percentage values may also be in danger. I don't feel it's right to call UrlDecode() in this case.

     
  • CodeDriller

    CodeDriller - 2015-01-24
    • status: open --> closed-invalid
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.