Skip to content

Commit 82294e2

Browse files
fix: SD-9364 remove regex for better performance
1 parent 630a77e commit 82294e2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

helpers/lib/cdnify.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ module.exports = globals => {
5656
}
5757

5858
if (protocol === 'webdav:') {
59-
const imgRegex = /.(jpg|jpeg|gif|png)$/i;
60-
const isImage = imgRegex.test(path);
59+
const supportedImageExtensions = ['jpg', 'jpeg', 'gif', 'png',];
60+
const isImage = supportedImageExtensions.some(ext => path.toLowerCase().includes(ext));
6161
const prefix = isImage ? 'images/stencil/original/content' : 'content'
6262
return [cdnUrl, prefix, path].join('/');
6363
}

0 commit comments

Comments
 (0)