Skip to content

Commit 021be8f

Browse files
committed
keep filename and ext
1 parent 5598c5d commit 021be8f

File tree

1 file changed

+3
-9
lines changed
  • src/components/design-library-list

1 file changed

+3
-9
lines changed

src/components/design-library-list/util.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -295,15 +295,9 @@ export const replaceImages = content => {
295295

296296
// Replace images in the content with low resolution images from the new image storage
297297
return content.replace(
298-
new RegExp( IMAGE_STORAGE.replace( /[.*+?^${}()|[\]\\]/g, '\\$&' ) + '([^\\/\\s]+)\\.(jpeg|jpg|png)', 'g' ),
299-
( match, filename, ext ) => {
300-
let newExt = ext
301-
if ( ext === 'jpeg' || ext === 'jpg' ) {
302-
newExt = 'jpg'
303-
} else if ( ext === 'png' ) {
304-
newExt = 'png'
305-
}
306-
return NEW_IMAGE_STORAGE + filename + '.' + newExt
298+
new RegExp( IMAGE_STORAGE.replace( /[.*+?^${}()|[\]\\]/g, '\\$&' ) + '([^\\/\\s]+\\.(jpeg|jpg|png))', 'g' ),
299+
( match, filenameWithExt ) => {
300+
return NEW_IMAGE_STORAGE + filenameWithExt
307301
}
308302
)
309303
}

0 commit comments

Comments
 (0)