From feb4afe3defc3bd575038919ad764dad478d8e3d Mon Sep 17 00:00:00 2001 From: "Libor M." Date: Fri, 3 Jan 2025 11:55:43 +0100 Subject: [PATCH] fixed sharing URL resolver for not available URLs #2828 --- CHANGELOG.md | 1 + src/base.js | 2 +- src/browser-extensions/index.js | 2 +- src/index.js | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3907a6c9b..f2d34f1a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Unreleased - Fixed URL resolving for same URL in browser +- Fixed sharing URL resolver for not available URLs ## 0.3.0-beta.15 - 2025-01-01 diff --git a/src/base.js b/src/base.js index 2f7d90641..47ecc447f 100644 --- a/src/base.js +++ b/src/base.js @@ -18,7 +18,7 @@ class pdfmake { options.progressCallback = this.progressCallback; options.tableLayouts = this.tableLayouts; - let printer = new Printer(this.fonts, this.virtualfs, this.urlResolver); + let printer = new Printer(this.fonts, this.virtualfs, this.urlResolver()); const pdfDocumentPromise = printer.createPdfKitDocument(docDefinition, options); return this._transformToDocument(pdfDocumentPromise); diff --git a/src/browser-extensions/index.js b/src/browser-extensions/index.js index e484c82cc..5d1c16fad 100644 --- a/src/browser-extensions/index.js +++ b/src/browser-extensions/index.js @@ -21,7 +21,7 @@ let defaultClientFonts = { class pdfmake extends pdfmakeBase { constructor() { super(); - this.urlResolver = new URLBrowserResolver(this.virtualfs); + this.urlResolver = () => new URLBrowserResolver(this.virtualfs); this.fonts = defaultClientFonts; } diff --git a/src/index.js b/src/index.js index 43cc75017..ed2d74975 100644 --- a/src/index.js +++ b/src/index.js @@ -5,7 +5,7 @@ const URLResolver = require('./URLResolver').default; class pdfmake extends pdfmakeBase { constructor() { super(); - this.urlResolver = new URLResolver(this.virtualfs); + this.urlResolver = () => new URLResolver(this.virtualfs); } _transformToDocument(doc) {