From 945db24553d085eb2e60e6ca5b4339eeae138e1b Mon Sep 17 00:00:00 2001 From: Spine Date: Wed, 2 Jul 2025 09:00:03 +0000 Subject: [PATCH] fix rendering of collage urls with no collage id --- classes/text.class.php | 3 +++ tests/phpunit/TextTest.php | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/classes/text.class.php b/classes/text.class.php index 11b20c235..d3ca4e180 100644 --- a/classes/text.class.php +++ b/classes/text.class.php @@ -359,6 +359,9 @@ class Text { return new \Gazelle\Manager\Artist()->findById((int)($args['id'] ?? 0))?->link(); case '/collages.php': + if (!isset($args['id']) && !isset($args['collageid'])) { + return "$url"; + } return self::bbcodeCollageUrl((int)($args['id'] ?? $args['collageid'])); case '/forums.php': diff --git a/tests/phpunit/TextTest.php b/tests/phpunit/TextTest.php index fe9b2a44e..545a60a59 100644 --- a/tests/phpunit/TextTest.php +++ b/tests/phpunit/TextTest.php @@ -124,6 +124,12 @@ class TextTest extends TestCase { \Text::full_format($collage->publicLocation()), 'text-collage-url' ); + $url = SITE_URL . '/collages.php?order=subscribers&sort=desc&page=2'; + $this->assertEquals( + "" . htmlentities($url) . "", + \Text::full_format($url), + 'text-collage-url-no-id', + ); $commentMan = new Manager\Comment(); $comment = $commentMan->create($this->userList['admin'], 'collages', $collage->id, "nice collage!"); $this->assertEquals(