From: Paul Hänsch <paul@plutz.net>
Date: Thu, 7 Mar 2024 15:40:50 +0000 (+0100)
Subject: bugfix: handle white space in filenames for image conversion
X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=fdfe0310c6bc644da671b847120e0bd84d923634;p=shellwiki

bugfix: handle white space in filenames for image conversion
---

diff --git a/handlers/40_attachment.sh b/handlers/40_attachment.sh
index fc0b0f9..bddaa47 100755
--- a/handlers/40_attachment.sh
+++ b/handlers/40_attachment.sh
@@ -42,9 +42,8 @@ attachment_convert(){
 
   case $attpath in
     *.[jJ][pP][gG]|*.[jJ][pP][eE][gG]|*.[pP][nN][gG])
-      read junk junk res junk <<-EOF
-	$(identify -- "$attpath")
-	EOF
+      res="$(identify -- "$attpath")"
+      res="${res% * * * * * *}" res="${res##* }"
       if [ "${res%x*}" -gt 2048 ]; then
         convert "$attpath" -resize 1920x-2 -quality 85 "$cachepath"
       else