Skip to content

Commit c2e960e

Browse files
committed
Disregard case when checking file extensions
1 parent f4cc9ed commit c2e960e

File tree

4 files changed

+7
-1
lines changed

4 files changed

+7
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
/package-lock.json
55

66
# Ignore the images
7+
*.JPEG
78
*.jpg
89
*.png
910
*.webp

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,5 +151,5 @@ function withFileExtension(...extensions) {
151151

152152
// extname follows this annoying idea that the dot belongs to the extension
153153
function extname(filename) {
154-
return path.extname(filename).slice(1);
154+
return path.extname(filename).slice(1).toLowerCase();
155155
}

test/prepare

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ curl -C - -o "test/test_basic/src/example.gif" "https://upload.wikimedia.org/wik
77
curl -C - -o "test/test_basic/src/example.svg" "https://upload.wikimedia.org/wikipedia/commons/0/02/SVG_logo.svg"
88
curl -C - -o "test/test_basic/src/example.webp" "https://www.gstatic.com/webp/gallery3/2_webp_a.webp"
99

10+
cp test/test_basic/src/example.jpg test/test_basic/src/UPPERCASE.JPEG
11+
1012
cp test/test_basic/src/example.jpg test/test_webp/src/example.jpg
1113
cp test/test_basic/src/example.png test/test_webp/src/example.png
1214
cp test/test_basic/src/example.webp test/test_webp/src/example.webp

test/run

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ begin "$root/test_basic"
5454
assert_smaller_size src/example.jpg dist/example.jpg
5555
assert_mime_type "image/jpeg" dist/example.jpg
5656

57+
assert_smaller_size src/UPPERCASE.JPEG dist/UPPERCASE.JPEG
58+
assert_mime_type "image/jpeg" dist/UPPERCASE.JPEG
59+
5760
assert_smaller_size src/example.png dist/example.png
5861
assert_mime_type "image/png" dist/example.png
5962

0 commit comments

Comments
 (0)