From 10ba2ccb7fee68f382d2574707b4fbc62105e5a3 Mon Sep 17 00:00:00 2001 From: Shish Date: Fri, 15 Dec 2023 07:55:38 +0000 Subject: [PATCH] fix search encoding --- core/tests/UrlsTest.php | 4 ++-- core/urls.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/tests/UrlsTest.php b/core/tests/UrlsTest.php index 5d939c84..59ab6342 100644 --- a/core/tests/UrlsTest.php +++ b/core/tests/UrlsTest.php @@ -13,11 +13,11 @@ class UrlsTest extends TestCase public function test_search_link() { $this->assertEquals( - "/test/post/list/bar+foo/1", + "/test/post/list/bar%20foo/1", search_link(["foo", "bar"]) ); $this->assertEquals( - "/test/post/list/cat%2A+rating%3D%5Eq/1", + "/test/post/list/cat%2A%20rating%3D%5Eq/1", search_link(["rating=?", "cat*"]) ); } diff --git a/core/urls.php b/core/urls.php index e2fbf864..35e62120 100644 --- a/core/urls.php +++ b/core/urls.php @@ -30,7 +30,7 @@ class Link function search_link(array $terms = [], int $page = 1): string { if($terms) { - $q = urlencode(Tag::caret(Tag::implode($terms))); + $q = rawurlencode(Tag::caret(Tag::implode($terms))); return make_link("post/list/$q/$page"); } else { return make_link("post/list/$page");