diff --git a/htmlhelper.cpp b/htmlhelper.cpp index be58afd..3eb1f5f 100644 --- a/htmlhelper.cpp +++ b/htmlhelper.cpp @@ -343,6 +343,12 @@ static Element serialize_post(const httplib::Request& req, const std::string& se blankie::html::HTMLString preprocessed_html = preprocess_html(req, server, post.emojis, post.content); // Workaround for https://vt.social/@a1ba@suya.place/110552480243348878#m if (preprocessed_html.str.find("
") == std::string::npos) {
+ size_t offset = 0;
+ while ((offset = preprocessed_html.str.find('\n', offset)) != std::string::npos) {
+ preprocessed_html.str.replace(offset, 1, "
");
+ offset += 4;
+ }
+
preprocessed_html.str.reserve(preprocessed_html.str.size() + 3 + 4);
preprocessed_html.str.insert(0, "
"); preprocessed_html.str.append("
"); diff --git a/routes/user.cpp b/routes/user.cpp index d298dec..5958034 100644 --- a/routes/user.cpp +++ b/routes/user.cpp @@ -88,6 +88,12 @@ static inline Element user_header(const httplib::Request& req, const std::string blankie::html::HTMLString preprocessed_bio = preprocess_html(req, account.server, account.emojis, account.note_html); // Workaround for https://social.kernel.org/@monsieuricon if (preprocessed_bio.str.find("") == std::string::npos) {
+ size_t offset = 0;
+ while ((offset = preprocessed_bio.str.find('\n', offset)) != std::string::npos) {
+ preprocessed_bio.str.replace(offset, 1, "
");
+ offset += 4;
+ }
+
preprocessed_bio.str.reserve(preprocessed_bio.str.size() + 3 + 4);
preprocessed_bio.str.insert(0, "
"); preprocessed_bio.str.append("
");