single-file-core 1.3.26 → 1.3.28

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.
package/core/util.js CHANGED
@@ -86,7 +86,12 @@ function getInstance(utilOptions) {
86
86
  return {
87
87
  getDoctypeString,
88
88
  getFilenameExtension(resourceURL, replacedCharacters, replacementCharacter) {
89
- const matchExtension = new URL(resourceURL).pathname.match(/(\.[^\\/.]*)$/);
89
+ let matchExtension;
90
+ try {
91
+ matchExtension = new URL(resourceURL).pathname.match(/(\.[^\\/.]*)$/);
92
+ } catch (error) {
93
+ // ignored
94
+ }
90
95
  return ((matchExtension && matchExtension[1] && this.getValidFilename(matchExtension[1], replacedCharacters, replacementCharacter)) || "").toLowerCase();
91
96
  },
92
97
  getContentTypeExtension(contentType) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "single-file-core",
3
- "version": "1.3.26",
3
+ "version": "1.3.28",
4
4
  "description": "SingleFile Core",
5
5
  "author": "Gildas Lormeau",
6
6
  "license": "AGPL-3.0-or-later",
@@ -15,4 +15,4 @@
15
15
  "url": "https://github.com/gildas-lormeau/single-file-core/issues"
16
16
  },
17
17
  "homepage": "https://github.com/gildas-lormeau/single-file-core#readme"
18
- }
18
+ }
@@ -370,7 +370,9 @@ function collectComments(content, comments) {
370
370
  const REGEXP_PRESERVE_STRING1 = /"([^\\"])*"/g;
371
371
  const REGEXP_PRESERVE_STRING1_BIS = /"(\\.)*"/g;
372
372
  const REGEXP_PRESERVE_STRING1_TER = /"(\\)*"/g;
373
- const REGEXP_PRESERVE_STRING2 = /'([^\\']|\\.|\\)*'/g;
373
+ const REGEXP_PRESERVE_STRING2 = /'([^\\'])*'/g;
374
+ const REGEXP_PRESERVE_STRING2_BIS = /'(\\.)*'/g;
375
+ const REGEXP_PRESERVE_STRING2_TER = /'(\\)*'/g;
374
376
  const REGEXP_MINIFY_ALPHA = /progid:DXImageTransform.Microsoft.Alpha\(Opacity=/gi;
375
377
  const REGEXP_PRESERVE_TOKEN1 = /\r\n/g;
376
378
  const REGEXP_PRESERVE_TOKEN2 = /[\r\n]/g;
@@ -445,11 +447,12 @@ function processString(content = "", options = defaultOptions) {
445
447
  content = extractDataUrls(content, preservedTokens);
446
448
  content = collectComments(content, comments);
447
449
 
448
- // preserve strings so their content doesn't get accidentally minified
449
450
  preserveString(REGEXP_PRESERVE_STRING1);
450
451
  preserveString(REGEXP_PRESERVE_STRING1_BIS);
451
452
  preserveString(REGEXP_PRESERVE_STRING1_TER);
452
453
  preserveString(REGEXP_PRESERVE_STRING2);
454
+ preserveString(REGEXP_PRESERVE_STRING2_BIS);
455
+ preserveString(REGEXP_PRESERVE_STRING2_TER);
453
456
 
454
457
  function preserveString(pattern) {
455
458
  content = content.replace(pattern, token => {