From c029f3b2702457e110142fc69e9900fd236de620 Mon Sep 17 00:00:00 2001 From: yaozm Date: Thu, 11 Apr 2024 16:09:25 +0800 Subject: [PATCH] refactor(feed): improve content rendering in FeedCommand - Refactored the content rendering logic in the FeedCommand - Used htmlspecialchars function to handle special characters in content --- app/Commands/FeedCommand.php | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/app/Commands/FeedCommand.php b/app/Commands/FeedCommand.php index cf7d98221b2..9860a4ca43f 100644 --- a/app/Commands/FeedCommand.php +++ b/app/Commands/FeedCommand.php @@ -54,15 +54,17 @@ static function (Collection $carry, string $line) use (&$date): Collection { 'date' => Date::createFromTimestamp(strtotime((string) $date)), 'title' => $title = (string) $line->match('/\[.*\]/')->trim('[]'), 'link' => $link = (string) $line->match('/\(.*\)/')->trim('()'), - 'content' => << -

$title

- - - HTML, + 'content' => htmlspecialchars( + << +

$title

+ + + HTML + ), ]); }, collect()