diff options
Diffstat (limited to 'src/reader.js')
| -rw-r--r-- | src/reader.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/reader.js b/src/reader.js index 8f8e784..a45ce9c 100644 --- a/src/reader.js +++ b/src/reader.js @@ -242,7 +242,7 @@ class ReaderClass extends AppCommon { console.error(err); - $(".loading-message").html(`Unable to load book info.<br/><small>${err.responseText}</small>`); + $(".loading-message").html(`Unable to load book info.<br/><small>${this.escapeHtml(err.responseText)}</small>`); return; } } @@ -285,7 +285,7 @@ class ReaderClass extends AppCommon { fileReader.onerror = (e) => { console.log('filereader error', e); - $(".loading-message").html("Unable to open book.<br/><small>" + e + "</small>"); + $(".loading-message").html("Unable to open book.<br/><small>" + this.escapeHtml(String(e)) + "</small>"); }; fileReader.readAsArrayBuffer(book_data); @@ -298,7 +298,7 @@ class ReaderClass extends AppCommon { await this.book.open(book_data); } catch (e) { console.error(e); - $(".loading-message").html(`Unable to open book.<br/><small>${e instanceof Error ? e.message: e}</small>`); + $(".loading-message").html(`Unable to open book.<br/><small>${this.escapeHtml(e instanceof Error ? e.message : String(e))}</small>`); return; } @@ -1406,7 +1406,7 @@ class ReaderClass extends AppCommon { console.error(err); - $(".dict_result").html(`Network error while looking up word: ${err.responseText}.`); + $(".dict_result").html(`Network error while looking up word: ${this.escapeHtml(err.responseText)}.`); } } @@ -1443,7 +1443,7 @@ class ReaderClass extends AppCommon { const a = $("<a>") .attr('href', '#') - .html(`<b class='pull-right'>${this.book.locations.locationFromCfi(row.cfi)}</b>${row.excerpt}`) + .html(`<b class='pull-right'>${this.book.locations.locationFromCfi(row.cfi)}</b>${this.escapeHtml(row.excerpt)}`) .attr('data-cfi', row.cfi) .on('click', () => { this.book.rendition.display($(a).attr('data-cfi')); |
