From 62c1ff1d47dead6798bed0ae810b3fb669bbd9b1 Mon Sep 17 00:00:00 2001 From: caiot5 Date: Mon, 9 Mar 2026 19:28:33 +0000 Subject: [PATCH] fix: correct path parsing for URLs containing non-ASCII and latin-1 encoded filenames --- warnick-2.1.4/warnick.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/warnick-2.1.4/warnick.sh b/warnick-2.1.4/warnick.sh index a095680..38fc8ba 100644 --- a/warnick-2.1.4/warnick.sh +++ b/warnick-2.1.4/warnick.sh @@ -669,11 +669,11 @@ while IFS="" read -r line || [ -n "$line" ]; do # Use tr to remove special characters, such as linefeeds. # Parse given URL to components # take last component of URL and get filename if exists - filename=$(echo "$link" |rev |cut -s -d'/' -f1 |cut -s -d'.' -f1- |rev) # file.html + LC_ALL=C filename=$(echo "$link" |rev |cut -s -d'/' -f1 |cut -s -d'.' -f1- |rev) # file.html if [[ -z $filename ]]; then path=$(echo "$link" |cut -s -d'/' -f2-) # path/to else - path=$(echo "$link" |rev |cut -s -d'/' -f2- |rev |cut -s -d'/' -f2-) # path/to + LC_ALL=C path=$(echo "$link" |rev |cut -s -d'/' -f2- |rev |cut -s -d'/' -f2-) # path/to fi if [[ ! -z "$path" ]] && [[ ! ${path: -1} == "/" ]]; then