A free, self-hostable news aggregator…
Call check_url_before_add hook when previewing a feed (#9343)
Ethan Stoner5fb62464e985
diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.phpindex 3a0b9a7da..7a30a9c83 100644--- a/app/Controllers/feedController.php+++ b/app/Controllers/feedController.php@@ -354,6 +354,15 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {// GET request: we must ask confirmation to user before adding feed.FreshRSS_View::prependTitle(_t('sub.feed.title_add') . ' · ');+ // Same hook as in addFeed(), so that the preview probes the URL that would actually be subscribed to.+ /** @var string|null $urlHooked */+ $urlHooked = Minz_ExtensionManager::callHook(Minz_HookType::CheckUrlBeforeAdd, $url);+ if ($urlHooked === null) {+ Minz_Request::bad(_t('feedback.sub.feed.not_added', $url), $url_redirect);+ return;+ }+ $url = $urlHooked;+$catDAO = FreshRSS_Factory::createCategoryDao();$this->view->categories = $catDAO->listCategories(prePopulateFeeds: false);$this->view->feed = new FreshRSS_Feed($url);