From 0ec305a886a36637beb67bf507d8022babba075f Mon Sep 17 00:00:00 2001 From: Shish Date: Thu, 30 Jan 2020 10:55:35 +0000 Subject: [PATCH] stop using ? as a wildcard --- core/imageboard/tag.php | 3 +-- ext/index/test.php | 12 ++++-------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/core/imageboard/tag.php b/core/imageboard/tag.php index a29ccdf4..f43bdcfb 100644 --- a/core/imageboard/tag.php +++ b/core/imageboard/tag.php @@ -110,7 +110,6 @@ class Tag natcasesort($tags1); natcasesort($tags2); - for ($i = 0; $i < count($tags1); $i++) { if ($tags1[$i]!==$tags2[$i]) { var_dump($tags1); @@ -163,7 +162,7 @@ class Tag $term = str_replace('_', '\_', $term); $term = str_replace('%', '\%', $term); $term = str_replace('*', '%', $term); - $term = str_replace("?", "_", $term); + // $term = str_replace("?", "_", $term); return $term; } } diff --git a/ext/index/test.php b/ext/index/test.php index 53becaf8..5dac2e88 100644 --- a/ext/index/test.php +++ b/ext/index/test.php @@ -46,18 +46,14 @@ class IndexTest extends ShimmiePHPUnitTestCase { $this->log_in_as_user(); $image_id_1 = $this->post_image("tests/pbx_screenshot.jpg", "question? colon:thing exclamation!"); + $image_id_2 = $this->post_image("tests/bedroom_workshop.jpg", "question. colon_thing exclamation%"); $this->assert_search_results(["question?"], [$image_id_1]); - $page = $this->get_page('post/list/question?/1'); - $this->assertEquals("/post/view/$image_id_1", $page->redirect); - + $this->assert_search_results(["question."], [$image_id_2]); $this->assert_search_results(["colon:thing"], [$image_id_1]); - $page = $this->get_page('post/list/colon:thing/1'); - $this->assertEquals("/post/view/$image_id_1", $page->redirect); - + $this->assert_search_results(["colon_thing"], [$image_id_2]); $this->assert_search_results(["exclamation!"], [$image_id_1]); - $page = $this->get_page('post/list/exclamation!/1'); - $this->assertEquals("/post/view/$image_id_1", $page->redirect); + $this->assert_search_results(["exclamation%"], [$image_id_2]); } // base case