Skip to content

Wiki - URL encoding leads to different pages #33

@itsrachelfish

Description

@itsrachelfish

The way the wiki handles pages does not play well with URL encoded characters. Firefox automatically URL encodes whatever page you go to when you navigate back to it from the suggestions in your address bar:

But the wiki considers folding@home and folding%40home to be different pages!

The page title should probably be urldecoded before we try to fetch the page content from the database.

This chaneg could either be made here, in the page view action:

function view($path, $action, $title, $content)
{
$content['PageNav']->Active("View Page");
$PageQuery = mysql_query("SELECT `ID`,`Title`,`Content`,`Edits`,`Views`,`EditTime` FROM `Wiki_Pages` WHERE `Path`='$path'");

Or it could be done in the index.php file as soon as the path variable is defined:

classic/wiki/index.php

Lines 54 to 58 in a9d212f

// New nginx rewrite
else
{
$uri = parse_url($_SERVER['REQUEST_URI']);
$Path = $uri['path'];

One caveat to adding urldecoding at that point will be the need to change the way page redirects work:

classic/wiki/index.php

Lines 84 to 90 in a9d212f

if(strpos($Path, ' ') !== FALSE || strpos($Path, '%20') !== FALSE)
die(Redirect(str_replace(array(' ', '%20'), '-', $Path), 0));
$Path = trim($Path, "/");
if($Path == "home")
$Path = "";

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions