diff options
author | Kevin Decherf <kevin@kdecherf.com> | 2018-01-07 17:28:04 +0100 |
---|---|---|
committer | Kevin Decherf <kevin@kdecherf.com> | 2018-10-21 16:15:31 +0200 |
commit | 781864b9546b0ff2d6fe42ce72f78b8f40b785e9 (patch) | |
tree | a6054e663c45e382b9aa140e18b91db8be0e5bd1 /src/Wallabag | |
parent | 4a81360efcdfe4bab8d75f7227c9cf5bfd514189 (diff) | |
download | wallabag-781864b9546b0ff2d6fe42ce72f78b8f40b785e9.tar.gz wallabag-781864b9546b0ff2d6fe42ce72f78b8f40b785e9.tar.zst wallabag-781864b9546b0ff2d6fe42ce72f78b8f40b785e9.zip |
ContentProxy: swap entry url to origin_url and set new url according to graby content
Closes #3529
Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
Diffstat (limited to 'src/Wallabag')
-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 | ||