This REALLY fixes bug #1 (I checked the size, but not properly resized the content 🤦)
the build was successful Details

This commit is contained in:
tastytea 2018-08-30 01:24:19 +02:00
parent 105b836651
commit d54d6513b6
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
2 changed files with 6 additions and 4 deletions

View File

@ -1,6 +1,6 @@
cmake_minimum_required (VERSION 3.6) cmake_minimum_required (VERSION 3.6)
project (mastorss project (mastorss
VERSION 0.7.6 VERSION 0.7.7
LANGUAGES CXX LANGUAGES CXX
) )

View File

@ -155,8 +155,9 @@ std::vector<Mastodon::Easy::Status> parse_website(const string &xml)
for (const string &hashtag : watchwords) for (const string &hashtag : watchwords)
{ {
std::regex rehashtag("([[:space:][:punct:]]|^)(" + hashtag + std::regex rehashtag("([[:space:][:punct:]]|^)(" + hashtag
")([[:space:][:punct:]]|$)", std::regex_constants::icase); + ")([[:space:][:punct:]]|$)",
std::regex_constants::icase);
content = std::regex_replace(content, rehashtag, "$1#$2$3", content = std::regex_replace(content, rehashtag, "$1#$2$3",
std::regex_constants::format_first_only); std::regex_constants::format_first_only);
} }
@ -167,7 +168,8 @@ std::vector<Mastodon::Easy::Status> parse_website(const string &xml)
if ((status.spoiler_text().size() + content.size() + link.size() + appendix_size) if ((status.spoiler_text().size() + content.size() + link.size() + appendix_size)
> static_cast<std::uint16_t>(max_size - 4)) > static_cast<std::uint16_t>(max_size - 4))
{ {
content.resize((max_size - link.size() - appendix_size - 4)); content.resize((max_size - status.spoiler_text().size()
- link.size() - appendix_size - 4));
content.resize(content.rfind(' ')); // Cut at word boundary content.resize(content.rfind(' ')); // Cut at word boundary
content += " […]"; content += " […]";
} }