Skip to content

Commit

Permalink
generic_getLinks() decodes HTML entities
Browse files Browse the repository at this point in the history
  • Loading branch information
veloman-yunkan committed Nov 14, 2023
1 parent d4a0c13 commit 8542b7d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ std::vector<html_link> generic_getLinks(const std::string& page)
while(*p != delimiter)
p++;
const std::string link(linkStart, p);
links.push_back(html_link(attr, link));
links.push_back(html_link(attr, decodeHtmlEntities(link)));
p += 1;
}
return links;
Expand Down
9 changes: 4 additions & 5 deletions test/tools-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,6 @@ TEST(tools, getLinks)
"{ src, https://fonts.io/css?family=OpenSans }"
);

// Known issue - HTML entities are not decoded
EXPECT_LINKS(
R"(<a href="/R&amp;D">Research and development</a>
blablabla
Expand All @@ -341,10 +340,10 @@ TEST(tools, getLinks)
<a href="/Presidents/Dwight_&quot;Ike&quot;_Eisenhower">#34</a>
<img src="https://example.com/getlogo?w=640&amp;h=480">
)",
"{ href, /R&amp;D }" "\n"
"{ href, ../syntax/&lt;script&gt; }" "\n"
"{ href, /Presidents/Dwight_&quot;Ike&quot;_Eisenhower }" "\n"
"{ src, https://example.com/getlogo?w=640&amp;h=480 }"
"{ href, /R&D }" "\n"
"{ href, ../syntax/<script> }" "\n"
"{ href, /Presidents/Dwight_\"Ike\"_Eisenhower }" "\n"
"{ src, https://example.com/getlogo?w=640&h=480 }"
);

// Known issue - HTML is not parsed and therefore false links
Expand Down

0 comments on commit 8542b7d

Please sign in to comment.