From f35be29ff27442aeb78828150eda24cc2795bd1d Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 5 Jul 2021 17:41:16 +0100 Subject: [PATCH] [Project] Another whitespace hack --- src/libserver/html/html.cxx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/libserver/html/html.cxx b/src/libserver/html/html.cxx index b29a7d37d..f9aacaf0c 100644 --- a/src/libserver/html/html.cxx +++ b/src/libserver/html/html.cxx @@ -1011,8 +1011,18 @@ html_append_content(struct html_content *hc, std::string_view data) -> auto { auto cur_offset = hc->parsed.size(); hc->parsed.append(data); + + if (cur_offset > 0 && data.size() > 0) { + auto last = hc->parsed.back(); + auto first_appended = data.front(); + if (first_appended == ' ' && !g_ascii_isspace(last)) { + cur_offset++; + } + } + auto nlen = decode_html_entitles_inplace(hc->parsed.data() + cur_offset, hc->parsed.size() - cur_offset, true); + hc->parsed.resize(nlen + cur_offset); return nlen; -- 2.39.5