urlAfterRedirect was always null (#699)

This commit is contained in:
Athou
2015-01-12 09:57:30 +01:00
parent 9d64426b00
commit c4185034e4
2 changed files with 3 additions and 3 deletions

View File

@@ -41,7 +41,7 @@ public class FeedFetcher {
byte[] content = result.getContent(); byte[] content = result.getContent();
try { try {
fetchedFeed = parser.parse(feedUrl, content); fetchedFeed = parser.parse(result.getUrlAfterRedirect(), content);
} catch (FeedException e) { } catch (FeedException e) {
if (extractFeedUrlFromHtml) { if (extractFeedUrlFromHtml) {
String extractedUrl = extractFeedUrl(StringUtils.newStringUtf8(result.getContent()), feedUrl); String extractedUrl = extractFeedUrl(StringUtils.newStringUtf8(result.getContent()), feedUrl);
@@ -50,7 +50,7 @@ public class FeedFetcher {
result = getter.getBinary(extractedUrl, lastModified, eTag, timeout); result = getter.getBinary(extractedUrl, lastModified, eTag, timeout);
content = result.getContent(); content = result.getContent();
fetchedFeed = parser.parse(feedUrl, content); fetchedFeed = parser.parse(result.getUrlAfterRedirect(), content);
} else { } else {
throw e; throw e;
} }

View File

@@ -77,7 +77,7 @@ public class FeedParser {
} }
entry.setGuid(FeedUtils.truncate(guid, 2048)); entry.setGuid(FeedUtils.truncate(guid, 2048));
entry.setUpdated(validateDate(getEntryUpdateDate(item), true)); entry.setUpdated(validateDate(getEntryUpdateDate(item), true));
entry.setUrl(FeedUtils.truncate(FeedUtils.toAbsoluteUrl(item.getLink(), feed.getLink(), feed.getUrlAfterRedirect()), 2048)); entry.setUrl(FeedUtils.truncate(FeedUtils.toAbsoluteUrl(item.getLink(), feed.getLink(), feedUrl), 2048));
// if link is empty but guid is used as url // if link is empty but guid is used as url
if (StringUtils.isBlank(entry.getUrl()) && StringUtils.startsWith(entry.getGuid(), "http")) { if (StringUtils.isBlank(entry.getUrl()) && StringUtils.startsWith(entry.getGuid(), "http")) {