From a6a7668e7ab15d7995623f91594c2a663ce781ff Mon Sep 17 00:00:00 2001 From: Libor M Date: Sat, 17 Sep 2022 15:19:25 +0200 Subject: [PATCH] Fixed refetching fonts from URL #2477 --- CHANGELOG.md | 1 + src/browser-extensions/URLBrowserResolver.js | 15 ++++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b6f46d2d0..581302654 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - Updated Roboto font (version 3.005) - Fixed calculating auto page height - Fixed TrueType Collection loading from URL +- Fixed refetching fonts from URL ## 0.2.5 - 2022-04-01 diff --git a/src/browser-extensions/URLBrowserResolver.js b/src/browser-extensions/URLBrowserResolver.js index 73151bb83..22a92b595 100644 --- a/src/browser-extensions/URLBrowserResolver.js +++ b/src/browser-extensions/URLBrowserResolver.js @@ -61,12 +61,17 @@ URLBrowserResolver.prototype.resolve = function (url, headers) { var _this = this; this.resolving[url] = new Promise(function (resolve, reject) { if (url.toLowerCase().indexOf('https://') === 0 || url.toLowerCase().indexOf('http://') === 0) { - fetchUrl(url, headers).then(function (buffer) { - _this.fs.writeFileSync(url, buffer); + if (_this.fs.existsSync(url)) { + // url was downloaded earlier resolve(); - }, function (result) { - reject(result); - }); + } else { + fetchUrl(url, headers).then(function (buffer) { + _this.fs.writeFileSync(url, buffer); + resolve(); + }, function (result) { + reject(result); + }); + } } else { // cannot be resolved resolve();