From 36e0d8d46e4099a55e75f521a3ed9534c34bd051 Mon Sep 17 00:00:00 2001 From: Shish Date: Sun, 11 Feb 2024 20:02:44 +0000 Subject: [PATCH] [core] guess at query encoding, hackily fixes #1026 --- core/urls.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/urls.php b/core/urls.php index 747eaae49..980bced8e 100644 --- a/core/urls.php +++ b/core/urls.php @@ -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 - * - generates + * - generates * q=post%2Flist * * This function should always return strings with no leading slashes @@ -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,