make sure enclosure urls fit in the database field

This commit is contained in:
Athou
2013-05-23 10:03:15 +02:00
parent c9f2b545c9
commit f9cfea4f79
4 changed files with 14 additions and 12 deletions

View File

@@ -98,17 +98,12 @@ public class FeedUpdateService {
private void handleEntry(Feed feed, FeedEntry entry) {
String baseUri = feed.getLink();
FeedEntryContent content = entry.getContent();
content.setEnclosureUrl(FeedUtils.truncate(content.getEnclosureUrl(),
2048));
content.setContent(FeedUtils.handleContent(content.getContent(),
baseUri));
String title = FeedUtils.handleContent(content.getTitle(), baseUri);
if (title != null) {
content.setTitle(title.substring(0, Math.min(2048, title.length())));
}
String author = entry.getAuthor();
if (author != null) {
entry.setAuthor(author.substring(0, Math.min(128, author.length())));
}
content.setTitle(FeedUtils.truncate(title, 2048));
entry.setAuthor(FeedUtils.truncate(entry.getAuthor(), 128));
}
}