From 2f4d8572b7e4178905e6cc1615ed8b9bc2516a0b Mon Sep 17 00:00:00 2001 From: Shish Date: Sat, 24 Feb 2024 17:34:51 +0000 Subject: [PATCH] [core] don't limit searchable tag length, only writable length, fixes #1087 --- core/imageboard/tag.php | 3 --- ext/post_tags/main.php | 1 + ext/post_tags/test.php | 6 +++--- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/core/imageboard/tag.php b/core/imageboard/tag.php index 1f6bc6f8..fab6b1f2 100644 --- a/core/imageboard/tag.php +++ b/core/imageboard/tag.php @@ -210,9 +210,6 @@ class Tag $tag = ""; } // hard-code one bad case... - if (mb_strlen($tag, 'UTF-8') > 255) { - throw new InvalidInput("The tag below is longer than 255 characters, please use a shorter tag.\n$tag\n"); - } return $tag; } diff --git a/ext/post_tags/main.php b/ext/post_tags/main.php index ed332718..ff21433c 100644 --- a/ext/post_tags/main.php +++ b/ext/post_tags/main.php @@ -141,6 +141,7 @@ class PostTags extends Extension } else { $page->flash($e->getMessage()); } + throw $e; } } } diff --git a/ext/post_tags/test.php b/ext/post_tags/test.php index 583af312..885d68d1 100644 --- a/ext/post_tags/test.php +++ b/ext/post_tags/test.php @@ -42,8 +42,8 @@ class PostTagsTest extends ShimmiePHPUnitTestCase public function testTagEdit_tooLong(): void { $this->log_in_as_user(); - $image_id = $this->post_image("tests/pbx_screenshot.jpg", str_repeat("a", 500)); - $this->get_page("post/view/$image_id"); - $this->assert_title("Post $image_id: tagme"); + $this->assertException(TagSetException::class, function () { + $this->post_image("tests/pbx_screenshot.jpg", str_repeat("a", 500)); + }); } }