From 4cd78d314856f833c21914c0ca91549f758403f8 Mon Sep 17 00:00:00 2001 From: Dylan Date: Sun, 24 Jan 2016 11:17:48 +1100 Subject: [PATCH] Fix issue where w3m couldn't display an image without a file extension --- fetch | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/fetch b/fetch index 0321671d..9fbb8cfa 100755 --- a/fetch +++ b/fetch @@ -1054,8 +1054,19 @@ getimage () { return fi - # Get name of image and prefix it with it's crop mode and offset - imgname="$crop_mode-$crop_offset-$imgsize-${img##*/}" + # Check to see if the image has a file extension + case "${img##*/}" in + *"."*) + # Get name of image and prefix it with it's crop mode and offset + imgname="$crop_mode-$crop_offset-$imgsize-${img##*/}" + ;; + + *) + # Add a file extension if the image doesn't have one. This + # fixes w3m not being able to display them. + imgname="$crop_mode-$crop_offset-$imgsize-${img##*/}.jpg" + ;; + esac # Check to see if the thumbnail exists before we do any cropping. if [ ! -f "$imgtempdir/$imgname" ]; then