Skip to content

Commit

Permalink
Fix extension detection bug in optimize-images
Browse files Browse the repository at this point in the history
If a filename has another dot in it, for example, "*.ls.png", it would grab "ls.png" instead of just "png". This commit fixes that.
  • Loading branch information
Pyker authored Nov 7, 2024
1 parent 5c0bca9 commit 07bcde8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/optimize-images.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ DATA=/home/jm/src/gotify/server/data

for FILE in "$DATA"/images/*; do
if [ "$FILE" -nt "$DATA"/images-optimized ]; then
EXT=$(echo "${FILE#*.}"|tr '[:upper:]' '[:lower:]')
EXT=$(echo "${FILE##*.}"|tr '[:upper:]' '[:lower:]')
if [ "$EXT" = png -o "$EXT" = jpg -o "$EXT" = jpeg -o "$EXT" = gif ]; then
convert "$FILE" -resize "512>" "$FILE"
fi
Expand Down

0 comments on commit 07bcde8

Please sign in to comment.