Skip to content

Commit

Permalink
[core] guess at query encoding, hackily fixes #1026
Browse files Browse the repository at this point in the history
  • Loading branch information
shish committed Feb 11, 2024
1 parent 024bfb9 commit 36e0d8d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion core/urls.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function make_link(?string $page = null, ?string $query = null, ?string $fragmen
* tell the difference between q=foo/bar and q=foo%2Fbar
* - REQUEST_URI contains the exact URI that was given to us, so we
* can parse it for ourselves
* - <input type="hidden" name="q" value="post/list"> generates
* - <input type='hidden' name='q' value='post/list'> generates
* q=post%2Flist
*
* This function should always return strings with no leading slashes
Expand All @@ -104,6 +104,11 @@ function _get_query(?string $uri = null): string
$q = $qps[1];
}
}
// if we have no slashes, but do have an encoded
// slash, then we _probably_ encoded too much
if(!str_contains($q, "/") && str_contains($q, "%2F")) {
$q = rawurldecode($q);
}
}

// if we're looking at http://site.com/$INSTALL_DIR/$PAGE,
Expand Down

0 comments on commit 36e0d8d

Please sign in to comment.