Skip to content

Commit

Permalink
Fixed refetching fonts from URL #2477
Browse files Browse the repository at this point in the history
  • Loading branch information
liborm85 committed Sep 17, 2022
1 parent eebdf14 commit a6a7668
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
15 changes: 10 additions & 5 deletions src/browser-extensions/URLBrowserResolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit a6a7668

Please sign in to comment.