Skip to content
This repository
Browse code

Fix relative links (issue #6)

  • Loading branch information...
commit 7eb7f42349f1e163c6f99b26197eb030c0eb751e 1 parent 49b2886
Barijaona Ramaholimihaso barijaona authored

Showing 1 changed file with 9 additions and 1 deletion. Show diff stats Hide diff stats

  1. +9 1 RefreshManager.m
10 RefreshManager.m
@@ -737,6 +737,9 @@ -(void)finalizeFolderRefresh:(NSDictionary*)parameters;
737 737 // Synthesize feed link if it is missing
738 738 if (feedLink == nil || [feedLink isBlank])
739 739 feedLink = [[folder feedURL] baseURL];
  740 + if (feedLink != nil && ![feedLink hasPrefix:@"http"])
  741 + feedLink = [[NSURL URLWithString:feedLink relativeToURL:url] absoluteString];
  742 +
740 743
741 744 // We'll be collecting articles into this array
742 745 NSMutableArray * articleArray = [NSMutableArray array];
@@ -788,7 +791,12 @@ -(void)finalizeFolderRefresh:(NSDictionary*)parameters;
788 791 [article setAuthor:[newsItem author]];
789 792 [article setBody:[newsItem description]];
790 793 [article setTitle:[newsItem title]];
791   - [article setLink:[newsItem link]];
  794 + NSString * articleLink = [newsItem link];
  795 + if (![articleLink hasPrefix:@"http"])
  796 + articleLink = [[NSURL URLWithString:articleLink relativeToURL:url] absoluteString];
  797 + if (articleLink == nil)
  798 + articleLink = feedLink;
  799 + [article setLink:articleLink];
792 800 [article setDate:articleDate];
793 801 [article setEnclosure:[newsItem enclosure]];
794 802 if ([[article enclosure] isNotEqualTo:@""])

0 comments on commit 7eb7f42

Please sign in to comment.
Something went wrong with that request. Please try again.