diff --git a/servehelper.cpp b/servehelper.cpp index f453c8c..79fa956 100644 --- a/servehelper.cpp +++ b/servehelper.cpp @@ -266,6 +266,12 @@ static std::regex mention_class_re("\\bmention\\b"); static inline void preprocess_link(const httplib::Request& req, const std::string& domain_name, lxb_dom_element_t* element) { using namespace std::string_literals; + // Remove target=... + lxb_status_t status = lxb_dom_element_remove_attribute(element, reinterpret_cast("target"), 6); + if (status != LXB_STATUS_OK) { + throw LXB::Exception(status); + } + size_t href_c_len; const lxb_char_t* href_c = lxb_dom_element_get_attribute(element, reinterpret_cast("href"), 4, &href_c_len); if (!href_c) { @@ -304,7 +310,7 @@ static inline void preprocess_link(const httplib::Request& req, const std::strin if (should_fix_link(element, cls)) { // Set the content of each to its href - lxb_status_t status = lxb_dom_node_text_content_set(lxb_dom_interface_node(element), reinterpret_cast(href.data()), href.size()); + status = lxb_dom_node_text_content_set(lxb_dom_interface_node(element), reinterpret_cast(href.data()), href.size()); if (status != LXB_STATUS_OK) { throw LXB::Exception(status); }