about summary refs log tree commit diff stats
path: root/src/reader.js
diff options
context:
space:
mode:
authorAndrew Dolgov <fox@fakecake.org>2026-06-19 13:26:20 +0300
committerAndrew Dolgov <fox@fakecake.org>2026-06-19 13:26:20 +0300
commitef7d52f85dfe611d536fcb96c3a61db1b8b67481 (patch)
treede050bf0171f4a211c4e8e91196b706c4db10fbf /src/reader.js
parent8eb610074f829cdcbbac035340318601fa41af5c (diff)
downloadthe-epube-ef7d52f85dfe611d536fcb96c3a61db1b8b67481.tar.gz
the-epube-ef7d52f85dfe611d536fcb96c3a61db1b8b67481.tar.xz
deal with some potential minor xss issues
Diffstat (limited to 'src/reader.js')
-rw-r--r--src/reader.js10
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'));