Skip to content

Commit

Permalink
fix: support uppercase file extensions in [Imagemin Guard]
Browse files Browse the repository at this point in the history
Updated patterns to support uppercase file extensions and ensured extensions are compared in lowercase. This enhances the accuracy of file matching and processing regardless of extension casing.

(This commit message was AI-generated.)

Signed-off-by: Jens Oliver Meiert <[email protected]>
  • Loading branch information
j9t committed Oct 7, 2024
1 parent 6074af4 commit 0c78615
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import { hideBin } from 'yargs/helpers'
const patterns = []

fileTypes.forEach((fileType) => {
patterns.push(`**/*.${fileType}`)
patterns.push(`**/*.${fileType}`, `**/*.${fileType.toUpperCase()}`)
})

if (ignore) {
Expand Down
2 changes: 1 addition & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const compression = async (filename, dry) => {
const tempFilePath = path.join(os.tmpdir(), path.basename(filename))

try {
const ext = path.extname(filename).slice(1)
const ext = path.extname(filename).slice(1).toLowerCase()
if (!ext) {
throw new Error(`Cannot determine file type for ${filename}; no extension found.`)
}
Expand Down

0 comments on commit 0c78615

Please sign in to comment.