Truncate all messages to valid length before sending.

This commit is contained in:
akwizgran
2016-10-19 14:23:24 +01:00
parent 9d2c56e75f
commit 06335c2c30
23 changed files with 279 additions and 163 deletions

View File

@@ -484,10 +484,7 @@ class FeedManagerImpl implements FeedManager, Client, EventListener {
private String getPostBody(String text) {
text = clean(text, article);
byte[] textBytes = StringUtils.toUtf8(text);
if (textBytes.length <= MAX_BLOG_POST_BODY_LENGTH)
return text;
return StringUtils.fromUtf8(textBytes, 0, MAX_BLOG_POST_BODY_LENGTH);
return StringUtils.truncateUtf8(text, MAX_BLOG_POST_BODY_LENGTH);
}
/**