From 7155c788e2efc35d71f14e932e792fda454cebb3 Mon Sep 17 00:00:00 2001 From: renaud gaudin Date: Thu, 2 Apr 2020 14:55:40 +0000 Subject: [PATCH] attach taskbar to `` instead of `\n` Fixed a regression introduced in block-external-links feature. For cleaner source, the taskbar (and the block-external JS file) were both attached to `\n`. Unfortunately, this isn't safe enough as some ZIM files might have all kinds of HTML syntax. Sotoki for instance have no CR after head, rendering the attachment impossible. Note: realizing this method is somehow fragile as any HTML content with extra attribute on the `` tag or without a `` tag would break the taskbar and the block external feature. --- src/server/response.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/server/response.cpp b/src/server/response.cpp index fdf1d80f6..bba6d3028 100644 --- a/src/server/response.cpp +++ b/src/server/response.cpp @@ -117,7 +117,7 @@ void Response::introduce_taskbar() auto head_content = render_template(RESOURCE::templates::head_part_html, data); m_content = appendToFirstOccurence( m_content, - "\n", + "", head_content); auto taskbar_part = render_template(RESOURCE::templates::taskbar_part_html, data); @@ -135,7 +135,7 @@ void Response::inject_externallinks_blocker() auto script_tag = render_template(RESOURCE::templates::external_blocker_part_html, data); m_content = appendToFirstOccurence( m_content, - "\n", + "", script_tag); }