fix search encoding

This commit is contained in:
Shish 2023-12-15 07:55:38 +00:00
parent 2dc79e9569
commit 10ba2ccb7f
2 changed files with 3 additions and 3 deletions

View file

@ -13,11 +13,11 @@ class UrlsTest extends TestCase
public function test_search_link() public function test_search_link()
{ {
$this->assertEquals( $this->assertEquals(
"/test/post/list/bar+foo/1", "/test/post/list/bar%20foo/1",
search_link(["foo", "bar"]) search_link(["foo", "bar"])
); );
$this->assertEquals( $this->assertEquals(
"/test/post/list/cat%2A+rating%3D%5Eq/1", "/test/post/list/cat%2A%20rating%3D%5Eq/1",
search_link(["rating=?", "cat*"]) search_link(["rating=?", "cat*"])
); );
} }

View file

@ -30,7 +30,7 @@ class Link
function search_link(array $terms = [], int $page = 1): string function search_link(array $terms = [], int $page = 1): string
{ {
if($terms) { if($terms) {
$q = urlencode(Tag::caret(Tag::implode($terms))); $q = rawurlencode(Tag::caret(Tag::implode($terms)));
return make_link("post/list/$q/$page"); return make_link("post/list/$q/$page");
} else { } else {
return make_link("post/list/$page"); return make_link("post/list/$page");