diff --git a/CMakeLists.txt b/CMakeLists.txt index 3dbb008..69154f0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required (VERSION 3.7) project (mastorss - VERSION 0.7.1 + VERSION 0.7.2 LANGUAGES CXX ) diff --git a/src/parse.cpp b/src/parse.cpp index a8d291d..64380ff 100644 --- a/src/parse.cpp +++ b/src/parse.cpp @@ -163,10 +163,12 @@ std::vector parse_website(const string &xml) } // Why is this necessary? Why does ##hashtag happen? content = std::regex_replace(content, std::regex("##"), "#"); - if ((content.size() + link.size()) > static_cast(max_size - 15)) + + uint16_t appendix_size = config[profile]["append"].asString().length(); + if ((content.size() + link.size() + appendix_size) + > static_cast(max_size - 4)) { - content.resize((max_size - link.size() - - config[profile]["append"].asString().length() - 4)); + content.resize((max_size - link.size() - appendix_size - 4)); content.resize(content.rfind(' ')); // Cut at word boundary content += " […]"; }