From 1467640c98cfa92da004cceb02acfafa4b6b5347 Mon Sep 17 00:00:00 2001 From: Robin Candau Date: Sat, 20 Jul 2024 12:50:10 +0200 Subject: [PATCH] fix(news): Make curl fail on http server errors responses when checking for recent news This commit makes curl fail on http server errors response (e.g. archlinux.org is down or under huge loads, responding http error code 504, 502, etc...). This is to prevent getting wrongly formatted news list in such scenarios, resulting in an unexpected error and incorrectly formatted news display. --- src/script/arch-update.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/script/arch-update.sh b/src/script/arch-update.sh index 599ec17..67d632b 100755 --- a/src/script/arch-update.sh +++ b/src/script/arch-update.sh @@ -355,7 +355,7 @@ list_packages() { # Definition of the list_news function: Display the latest Arch news and offers to read them list_news() { info_msg "$(eval_gettext "Looking for recent Arch News...")" - news=$(curl -m 30 -Ls https://www.archlinux.org/news || echo "timeout") + news=$(curl -m 30 -Lfs https://www.archlinux.org/news || echo "timeout") if [ "${news}" == "timeout" ]; then echo @@ -418,7 +418,7 @@ list_news() { news_selected=$(sed -n "${num}"p <<< "${news_titles}") news_path=$(echo "${news_selected}" | sed s/\ -//g | sed s/\ /-/g | sed s/[.]//g | sed s/=//g | sed s/\>//g | sed s/\