X-Git-Url: https://git.plutz.net/?a=blobdiff_plain;f=handlers%2F40_attachment.sh;h=fc0b0f983ff00aee3a0787c1e38761315d973697;hb=568b1592bacd27eb3e2b9d9dd87ccb73c2650bd3;hp=5ea36e90b568aa30b7cd32385ccd452e00ce83c1;hpb=64b39909f4a3f4d67269718c8f5e8e4b7ea092b3;p=shellwiki 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 }