From 2f027545226eca238a6a80021cb3ac0e60b51696 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Thu, 26 Jan 2023 08:13:38 +0100 Subject: Increase max feed URL length and drop unicity (#5038) * Increase max feed URL length and drop unicity #fix https://github.com/FreshRSS/FreshRSS/issues/4338 Drop the unicity constraint on our feed URL. In practice, this did not add much value as identical feeds could have different URLs. And it generated several problems, for instance during renaming or automatic redirections such as from HTTP to HTTPS, with collisions for which we dot not have any elegant handling. I have kept a high limit of 32768 because cURL does not seem to have any limit except memory, which might lead to memory problems. This is the highest server-side value reported by https://www.sistrix.com/ask-sistrix/technical-seo/site-structure/url-length-how-long-can-a-url-be * Same for Web site URL For consistency --- app/Models/FeedDAO.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/Models/FeedDAO.php') diff --git a/app/Models/FeedDAO.php b/app/Models/FeedDAO.php index 5993f50dc..ef48789ff 100644 --- a/app/Models/FeedDAO.php +++ b/app/Models/FeedDAO.php @@ -49,11 +49,11 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo implements FreshRSS_Searchable { } $values = array( - substr($valuesTmp['url'], 0, 511), + $valuesTmp['url'], $valuesTmp['kind'] ?? FreshRSS_Feed::KIND_RSS, $valuesTmp['category'], mb_strcut(trim($valuesTmp['name']), 0, FreshRSS_DatabaseDAO::LENGTH_INDEX_UNICODE, 'UTF-8'), - substr($valuesTmp['website'], 0, 255), + $valuesTmp['website'], sanitizeHTML($valuesTmp['description'], '', 1023), $valuesTmp['lastUpdate'], isset($valuesTmp['priority']) ? intval($valuesTmp['priority']) : FreshRSS_Feed::PRIORITY_MAIN_STREAM, -- cgit v1.2.3 From 44f72889a589758da1b026a5288e23987a525095 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 4 Mar 2023 10:06:30 +0100 Subject: Safer updateCachedValues (#5158) #fix https://github.com/FreshRSS/FreshRSS/issues/5156 --- app/Models/FeedDAO.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/Models/FeedDAO.php') diff --git a/app/Models/FeedDAO.php b/app/Models/FeedDAO.php index ef48789ff..1aae5fee5 100644 --- a/app/Models/FeedDAO.php +++ b/app/Models/FeedDAO.php @@ -434,7 +434,7 @@ SQL; . '`cache_nbUnreads`=(SELECT COUNT(e2.id) FROM `_entry` e2 WHERE e2.id_feed=`_feed`.id AND e2.is_read=0)' . ($id != 0 ? ' WHERE id=:id' : ''); $stm = $this->pdo->prepare($sql); - if ($id != 0) { + if ($stm && $id != 0) { $stm->bindParam(':id', $id, PDO::PARAM_INT); } -- cgit v1.2.3