From 07efaf71eac19934d858df678576823da131d1bb Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Thu, 26 Jan 2023 08:59:34 +0100 Subject: Fix error handling when updating URL (#5039) Fix 3 related error handling when updating the feed URL with an invalid URL. Previously leading to unclear 500 page with additional PHP errors. --- app/Controllers/subscriptionController.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'app/Controllers/subscriptionController.php') diff --git a/app/Controllers/subscriptionController.php b/app/Controllers/subscriptionController.php index 315187aaa..c1acfd958 100644 --- a/app/Controllers/subscriptionController.php +++ b/app/Controllers/subscriptionController.php @@ -256,7 +256,7 @@ class FreshRSS_subscription_Controller extends FreshRSS_ActionController { $url_redirect = array('c' => 'subscription', 'params' => array('id' => $id)); } - if ($feedDAO->updateFeed($id, $values) !== false) { + if ($values['url'] != '' && $feedDAO->updateFeed($id, $values) !== false) { $feed->_categoryId($values['category']); // update url and website values for faviconPrepare $feed->_url($values['url'], false); @@ -265,6 +265,9 @@ class FreshRSS_subscription_Controller extends FreshRSS_ActionController { Minz_Request::good(_t('feedback.sub.feed.updated'), $url_redirect); } else { + if ($values['url'] == '') { + Minz_Log::warning('Invalid feed URL!'); + } Minz_Request::bad(_t('feedback.sub.feed.error'), $url_redirect); } } -- cgit v1.2.3