From: Paul Hänsch Date: Mon, 9 Oct 2023 08:54:06 +0000 (+0200) Subject: case insensitive attachment suffixes X-Git-Url: https://git.plutz.net/?p=shellwiki;a=commitdiff_plain;h=568b1592bacd27eb3e2b9d9dd87ccb73c2650bd3 case insensitive attachment suffixes --- diff --git a/handlers/40_attachment.sh b/handlers/40_attachment.sh index 5ea36e9..fc0b0f9 100755 --- a/handlers/40_attachment.sh +++ b/handlers/40_attachment.sh @@ -35,15 +35,15 @@ attachment_convert(){ elif [ -f "$cachepath" ]; then printf %s "$attpath" return 0 - elif ! mkdir -p -- "${cachepath%/*}" && touch "$cachepath"; then + elif ! mkdir -p -- "${cachepath%/*}" && touch -- "$cachepath"; then printf %s "$attpath" return 0 fi case $attpath in - *.jpg|*.jpeg|*.png) + *.[jJ][pP][gG]|*.[jJ][pP][eE][gG]|*.[pP][nN][gG]) read junk junk res junk <<-EOF - $(identify "$attpath") + $(identify -- "$attpath") EOF if [ "${res%x*}" -gt 2048 ]; then convert "$attpath" -resize 1920x-2 -quality 85 "$cachepath" @@ -53,7 +53,7 @@ attachment_convert(){ printf %s "$cachepath" return 0 ;; - *.webm|*.mp4|*.mkv|*.avi) + *.[wW][eE][bB][mM]|*.[mM][pP]4|*.[mM][kK][vV]|*.[aA][vV][iI]) res=$(ffprobe -show_entries stream=width "$attpath" 2>&-) res="${res#*width=}" res="${res%%${BR}*}" if [ "$res" -gt 1280 ]; then @@ -77,7 +77,7 @@ attachment_convert(){ printf %s "$attpath" return 0 ;; - *) printf "$attpath";; + *) printf %s "$attpath";; esac }