single-file-core 1.5.113 → 1.5.114

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "single-file-core",
3
- "version": "1.5.113",
3
+ "version": "1.5.114",
4
4
  "description": "SingleFile Core",
5
5
  "author": "Gildas Lormeau",
6
6
  "license": "AGPL-3.0-or-later",
@@ -113,7 +113,9 @@ const MAX_APPENDED_DATA_LENGTH = 65535;
113
113
  const PDF_ENTRY_FILENAME = "page.pdf";
114
114
  const PDF_HEADER_MAX_OFFSET = 1024;
115
115
  const MINIMAL_DOCTYPE = "<!DOCTYPE html>";
116
- const UNHIDDEN_FACE_WARNING_MESSAGE = "SingleFile: the archive was written without a face, its data names every wrapper tag:";
116
+ const UNHIDDEN_FACE_WARNING_MESSAGE = "SingleFile: the page data contains every HTML tag that could hide an embedded file, the archive was written without its";
117
+ const EMBEDDED_IMAGE_LABEL = "PNG image";
118
+ const EMBEDDED_PDF_LABEL = "PDF document";
117
119
  const LOCAL_FILE_HEADER_SIGNATURE = 0x04034b50;
118
120
  const CENTRAL_FILE_HEADER_SIGNATURE = 0x02014b50;
119
121
  const END_OF_CENTRAL_DIR_SIGNATURE = 0x06054b50;
@@ -181,7 +183,7 @@ async function createArchive(pageData, options, script, writeEntries, lastModDat
181
183
  if (options.embeddedImage && options.selfExtractingArchive) {
182
184
  imageChunk = getImageHTMLChunk(pageData, options, lastModDate);
183
185
  if (!imageChunk) {
184
- dropUnhiddenFace(options, "embeddedImage");
186
+ dropUnhiddenFace(options, "embeddedImage", EMBEDDED_IMAGE_LABEL);
185
187
  }
186
188
  }
187
189
  if (options.embeddedImage) {
@@ -582,7 +584,7 @@ function getStartHTMLArray(pageData, options, lastModDate, startTag = "") {
582
584
  const embeddedPdfText = TEXT_DECODER.decode(localHeader) + TEXT_DECODER.decode(embeddedPdf);
583
585
  const pdfTagIndex = findEmbeddedDataTagIndex(embeddedPdfText);
584
586
  if (pdfTagIndex == -1) {
585
- dropUnhiddenFace(options, "embeddedPdf");
587
+ dropUnhiddenFace(options, "embeddedPdf", EMBEDDED_PDF_LABEL);
586
588
  pdfEntry = undefined;
587
589
  } else {
588
590
  const [pdfStartTag, pdfEndTag] = EMBEDDED_DATA_TAGS[pdfTagIndex];
@@ -704,9 +706,9 @@ function getEmbeddedImageData(embeddedImage) {
704
706
  return embeddedImage.slice(PNG_SIGNATURE_LENGTH + PNG_IHDR_LENGTH, embeddedImage.length - PNG_IEND_LENGTH);
705
707
  }
706
708
 
707
- function dropUnhiddenFace(options, name) {
709
+ function dropUnhiddenFace(options, name, label) {
708
710
  delete options[name];
709
- console.warn(UNHIDDEN_FACE_WARNING_MESSAGE, name); // eslint-disable-line no-console
711
+ console.warn(UNHIDDEN_FACE_WARNING_MESSAGE, label); // eslint-disable-line no-console
710
712
  }
711
713
 
712
714
  async function writeData(writable, array) {