Skip to content

Commit

Permalink
fix: convert file extension to lowercase before image upload
Browse files Browse the repository at this point in the history
Some search engines may not return results or display an error
if the image file extension is in uppercase.
  • Loading branch information
dessant committed Jun 23, 2024
1 parent 48e6e4a commit 2d40193
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/utils/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,9 @@ function normalizeImageFilename({name, type} = {}) {

if (currentType !== type) {
name = name.replace(new RegExp(`${currentExt}$`, 'i'), newExt);
} else if (!name.endsWith(currentExt)) {
// convert file extension to lowercase
name = name.replace(new RegExp(`${currentExt}$`, 'i'), currentExt);
}
} else {
name = `${name}.${newExt}`;
Expand Down

0 comments on commit 2d40193

Please sign in to comment.