diff options
Diffstat (limited to 'src/Wallabag/CoreBundle')
-rw-r--r-- | src/Wallabag/CoreBundle/Helper/ContentProxy.php | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/Wallabag/CoreBundle/Helper/ContentProxy.php b/src/Wallabag/CoreBundle/Helper/ContentProxy.php index f0d8c1b4..da0ec5a3 100644 --- a/src/Wallabag/CoreBundle/Helper/ContentProxy.php +++ b/src/Wallabag/CoreBundle/Helper/ContentProxy.php | |||
@@ -68,9 +68,8 @@ class ContentProxy | |||
68 | 68 | ||
69 | // In one case (at least in tests), url is empty here | 69 | // In one case (at least in tests), url is empty here |
70 | // so we set it using $url provided in the updateEntry call. | 70 | // so we set it using $url provided in the updateEntry call. |
71 | // Not sure what are the other possible cases where this property is empty | 71 | // Not sure what are the other possible cases where this property is empty |
72 | if (empty($entry->getUrl()) && !empty($url)) | 72 | if (empty($entry->getUrl()) && !empty($url)) { |
73 | { | ||
74 | $entry->setUrl($url); | 73 | $entry->setUrl($url); |
75 | } | 74 | } |
76 | 75 | ||
@@ -247,7 +246,15 @@ class ContentProxy | |||
247 | */ | 246 | */ |
248 | private function stockEntry(Entry $entry, array $content) | 247 | private function stockEntry(Entry $entry, array $content) |
249 | { | 248 | { |
250 | $entry->setUrl($content['url']); | 249 | // When a redirection occurs while fetching an entry |
250 | // we move the original url in origin_url property if empty | ||
251 | // and set the entry url with the final value | ||
252 | if (!empty($content['url']) && $entry->getUrl() !== $content['url']) { | ||
253 | if (empty($entry->getOriginUrl())) { | ||
254 | $entry->setOriginUrl($entry->getUrl()); | ||
255 | } | ||
256 | $entry->setUrl($content['url']); | ||
257 | } | ||
251 | 258 | ||
252 | $this->setEntryDomainName($entry); | 259 | $this->setEntryDomainName($entry); |
253 | 260 | ||