forked from wallabag/wallabag
updateOriginUrl: rewrite some if, resolving feedbacks from PR
Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
This commit is contained in:
@ -321,7 +321,10 @@ class ContentProxy
|
|||||||
*/
|
*/
|
||||||
private function updateOriginUrl(Entry $entry, $url)
|
private function updateOriginUrl(Entry $entry, $url)
|
||||||
{
|
{
|
||||||
if (!empty($url) && $entry->getUrl() !== $url) {
|
if (empty($url) || $entry->getUrl() === $url) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$parsed_entry_url = parse_url($entry->getUrl());
|
$parsed_entry_url = parse_url($entry->getUrl());
|
||||||
$parsed_content_url = parse_url($url);
|
$parsed_content_url = parse_url($url);
|
||||||
|
|
||||||
@ -334,7 +337,9 @@ class ContentProxy
|
|||||||
|
|
||||||
if ($this->ignoreUrl($entry->getUrl())) {
|
if ($this->ignoreUrl($entry->getUrl())) {
|
||||||
$entry->setUrl($url);
|
$entry->setUrl($url);
|
||||||
} else {
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
switch ($diff_keys) {
|
switch ($diff_keys) {
|
||||||
case ['path']:
|
case ['path']:
|
||||||
if (($parsed_entry_url['path'] . '/' === $parsed_content_url['path']) // diff is trailing slash, we only replace the url of the entry
|
if (($parsed_entry_url['path'] . '/' === $parsed_content_url['path']) // diff is trailing slash, we only replace the url of the entry
|
||||||
@ -358,8 +363,6 @@ class ContentProxy
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check entry url against an ignore list to replace with content url.
|
* Check entry url against an ignore list to replace with content url.
|
||||||
|
|||||||
Reference in New Issue
Block a user