@colijnit/configuratorcore 262.1.7 → 262.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -640,6 +640,8 @@ class ImageUtils {
640
640
  return 'data:image/gif;base64,' + documentBody;
641
641
  case 'bmp':
642
642
  return 'data:image/bmp;base64,' + documentBody;
643
+ case 'webp':
644
+ return 'data:image/webp;base64,' + documentBody;
643
645
  default:
644
646
  return 'data:image/png;base64,' + documentBody;
645
647
  }
@@ -999,7 +1001,8 @@ class FileUtils {
999
1001
  // Return the mimetype of the given filename.
1000
1002
  static MimeTypeFromFilename(fileName) {
1001
1003
  const regEx = /(?:\.([^.]+))?$/; // regex to find extension
1002
- const extension = regEx.exec(fileName)[1];
1004
+ const match = regEx.exec(fileName)[1];
1005
+ const extension = match ? match.toLowerCase() : '';
1003
1006
  switch (extension) {
1004
1007
  case 'jpg':
1005
1008
  case 'jpeg':
@@ -1008,6 +1011,8 @@ class FileUtils {
1008
1011
  return 'image/png';
1009
1012
  case 'bmp':
1010
1013
  return 'image/bmp';
1014
+ case 'webp':
1015
+ return 'image/webp';
1011
1016
  }
1012
1017
  }
1013
1018
  /**
@@ -1490,6 +1495,7 @@ class VariationUtils {
1490
1495
  case 'jpeg':
1491
1496
  case 'png':
1492
1497
  case 'bmp':
1498
+ case 'webp':
1493
1499
  return true;
1494
1500
  default:
1495
1501
  return false;
@@ -1505,6 +1511,8 @@ class VariationUtils {
1505
1511
  return 'png';
1506
1512
  case 'bmp':
1507
1513
  return 'bmp';
1514
+ case 'webp':
1515
+ return 'webp';
1508
1516
  default:
1509
1517
  return 'jpeg';
1510
1518
  }