From 5f335a54c915d402c58866d088babc8c9262ae30 Mon Sep 17 00:00:00 2001 From: Shish Date: Fri, 9 Feb 2024 11:13:24 +0000 Subject: [PATCH] [link_scan] apply to POST --- ext/link_scan/main.php | 6 +++--- ext/link_scan/test.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ext/link_scan/main.php b/ext/link_scan/main.php index 9b5e7e15..386ee19f 100644 --- a/ext/link_scan/main.php +++ b/ext/link_scan/main.php @@ -15,10 +15,10 @@ class LinkScan extends Extension { global $config, $page; - if ($event->page_matches("post/list") && isset($_GET['search'])) { + if ($event->page_matches("post/list") && isset($_POST['search'])) { $trigger = $config->get_string("link_scan_trigger", "https?://"); - if (preg_match("#.*{$trigger}.*#", $_GET['search'])) { - $ids = $this->scan($_GET['search']); + if (preg_match("#.*{$trigger}.*#", $_POST['search'])) { + $ids = $this->scan($_POST['search']); $page->set_mode(PageMode::REDIRECT); $page->set_redirect(search_link(["id=".implode(",", $ids)])); $event->stop_processing = true; diff --git a/ext/link_scan/test.php b/ext/link_scan/test.php index 9fe8a785..075b560d 100644 --- a/ext/link_scan/test.php +++ b/ext/link_scan/test.php @@ -19,7 +19,7 @@ class LinkScanTest extends ShimmiePHPUnitTestCase But there is no http://example.com/post/view/65432 "; - $page = $this->get_page("post/list", ["search" => $text]); + $page = $this->post_page("post/list", ["search" => $text]); $this->assertEquals(PageMode::REDIRECT, $page->mode); $this->assertEquals("/test/post/list/id%3D{$image_id_1}%2C{$image_id_2}/1", $page->redirect); @@ -35,7 +35,7 @@ class LinkScanTest extends ShimmiePHPUnitTestCase Look at http://example.com/_images/feb01bab5698a11dd87416724c7a89e3/foobar.jpg there is an image or search for e106ea2983e1b77f11e00c0c54e53805 but one that doesn't exist is e106ea2983e1b77f11e00c0c54e50000 o.o"; - $page = $this->get_page("post/list", ["search" => $text]); + $page = $this->post_page("post/list", ["search" => $text]); $this->assertEquals(PageMode::REDIRECT, $page->mode); $this->assertEquals("/test/post/list/id%3D{$image_id_1}%2C{$image_id_2}/1", $page->redirect); @@ -48,7 +48,7 @@ class LinkScanTest extends ShimmiePHPUnitTestCase $this->post_image("tests/favicon.png", "TeStCase"); $text = "Look at feb01bab5698a11dd87416724c7a89e3/foobar.jpg"; - $page = $this->get_page("post/list", ["search" => $text]); + $page = $this->post_page("post/list", ["search" => $text]); $this->assertEquals(PageMode::REDIRECT, $page->mode); $this->assertEquals("/test/post/list/at%20feb01bab5698a11dd87416724c7a89e3%2Ffoobar.jpg%20Look/1", $page->redirect);