diff options
author | Kevin Decherf <kevin@kdecherf.com> | 2018-01-07 17:28:04 +0100 |
---|---|---|
committer | Kevin Decherf <kevin@kdecherf.com> | 2018-01-14 16:41:56 +0100 |
commit | c801d03e46ae036d8b1898f884769e361c51ed58 (patch) | |
tree | 5392b0669d0320582d4df621f607fd64f07a1490 /src | |
parent | 3362b3e3d340e6e24d703b38010870479ab0f67c (diff) | |
download | wallabag-c801d03e46ae036d8b1898f884769e361c51ed58.tar.gz wallabag-c801d03e46ae036d8b1898f884769e361c51ed58.tar.zst wallabag-c801d03e46ae036d8b1898f884769e361c51ed58.zip |
ContentProxy: swap entry url to origin_url and set new url according to graby contenturl-3529
Closes #3529
Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
Diffstat (limited to 'src')
-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 19fcbfbf..c7ccfe4a 100644 --- a/src/Wallabag/CoreBundle/Helper/ContentProxy.php +++ b/src/Wallabag/CoreBundle/Helper/ContentProxy.php | |||
@@ -67,9 +67,8 @@ class ContentProxy | |||
67 | 67 | ||
68 | // In one case (at least in tests), url is empty here | 68 | // In one case (at least in tests), url is empty here |
69 | // so we set it using $url provided in the updateEntry call. | 69 | // so we set it using $url provided in the updateEntry call. |
70 | // Not sure what are the other possible cases where this property is empty | 70 | // Not sure what are the other possible cases where this property is empty |
71 | if (empty($entry->getUrl()) && !empty($url)) | 71 | if (empty($entry->getUrl()) && !empty($url)) { |
72 | { | ||
73 | $entry->setUrl($url); | 72 | $entry->setUrl($url); |
74 | } | 73 | } |
75 | 74 | ||
@@ -193,7 +192,15 @@ class ContentProxy | |||
193 | */ | 192 | */ |
194 | private function stockEntry(Entry $entry, array $content) | 193 | private function stockEntry(Entry $entry, array $content) |
195 | { | 194 | { |
196 | $entry->setUrl($content['url']); | 195 | // When a redirection occurs while fetching an entry |
196 | // we move the original url in origin_url property if empty | ||
197 | // and set the entry url with the final value | ||
198 | if (!empty($content['url']) && $entry->getUrl() !== $content['url']) { | ||
199 | if (empty($entry->getOriginUrl())) { | ||
200 | $entry->setOriginUrl($entry->getUrl()); | ||
201 | } | ||
202 | $entry->setUrl($content['url']); | ||
203 | } | ||
197 | 204 | ||
198 | $this->setEntryDomainName($entry); | 205 | $this->setEntryDomainName($entry); |
199 | 206 | ||