[epiphany/mcatanzaro/unbreak-reader-mode] reader-handler: unbreak reader mode
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/mcatanzaro/unbreak-reader-mode] reader-handler: unbreak reader mode
- Date: Thu, 16 Dec 2021 16:17:26 +0000 (UTC)
commit 1910179a8625de2ac542d40c54228d00cf1e8628
Author: Michael Catanzaro <mcatanzaro redhat com>
Date: Thu Dec 16 10:16:05 2021 -0600
reader-handler: unbreak reader mode
Oops, we are not supposed to encode the page content here. I must have
somehow messed up badly when testing this yesterday.
This regressed in !1046
embed/ephy-reader-handler.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/embed/ephy-reader-handler.c b/embed/ephy-reader-handler.c
index 0b6daa29f..27ef80607 100644
--- a/embed/ephy-reader-handler.c
+++ b/embed/ephy-reader-handler.c
@@ -160,7 +160,6 @@ readability_js_finish_cb (GObject *object,
g_autofree gchar *byline = NULL;
g_autofree gchar *encoded_byline = NULL;
g_autofree gchar *content = NULL;
- g_autofree gchar *encoded_content = NULL;
g_autofree gchar *encoded_title = NULL;
g_autoptr (GString) html = NULL;
g_autoptr (GBytes) style_css = NULL;
@@ -182,7 +181,6 @@ readability_js_finish_cb (GObject *object,
title = webkit_web_view_get_title (web_view);
encoded_byline = byline ? ephy_encode_for_html_entity (byline) : g_strdup ("");
- encoded_content = ephy_encode_for_html_entity (content);
encoded_title = ephy_encode_for_html_entity (title);
html = g_string_new (NULL);
@@ -219,7 +217,14 @@ readability_js_finish_cb (GObject *object,
color_scheme,
encoded_title,
encoded_byline);
- g_string_append (html, encoded_content);
+
+ /* We cannot encode the page content because it contains HTML tags inserted by
+ * Readability.js. Readability.js is responsible for ensuring nasty stuff like
+ * script tags are removed. However, the title and byline (above) really do
+ * need to be encoded because Readability.js unescapes them before returning
+ * them to us.
+ */
+ g_string_append (html, content);
g_string_append (html, "</article>");
finish_uri_scheme_request (request, g_strdup (html->str), NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]