mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
make sure enclosure urls fit in the database field
This commit is contained in:
@@ -50,8 +50,7 @@ public class FeedFetcher {
|
||||
fetchedFeed = parser.parse(feedUrl, result.getContent());
|
||||
Feed feed = fetchedFeed.getFeed();
|
||||
feed.setLastModifiedHeader(result.getLastModifiedSince());
|
||||
feed.setEtagHeader(org.apache.commons.lang.StringUtils.substring(
|
||||
result.geteTag(), 0, 255));
|
||||
feed.setEtagHeader(FeedUtils.truncate(result.geteTag(), 255));
|
||||
fetchedFeed.setFetchDuration(result.getDuration());
|
||||
return fetchedFeed;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,13 @@ import com.google.api.client.util.Lists;
|
||||
|
||||
public class FeedUtils {
|
||||
|
||||
public static String truncate(String string, int length) {
|
||||
if (string != null) {
|
||||
string = string.substring(0, Math.min(length, string.length()));
|
||||
}
|
||||
return string;
|
||||
}
|
||||
|
||||
public static String guessEncoding(byte[] bytes) {
|
||||
String DEFAULT_ENCODING = "UTF-8";
|
||||
UniversalDetector detector = new UniversalDetector(null);
|
||||
|
||||
Reference in New Issue
Block a user