Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wiki - URL encoding leads to different pages #33

Open
itsrachelfish opened this issue Apr 30, 2020 · 0 comments
Open

Wiki - URL encoding leads to different pages #33

itsrachelfish opened this issue Apr 30, 2020 · 0 comments

Comments

@itsrachelfish
Copy link
Member

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 = "";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant