summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfox <[email protected]>2017-12-13 05:21:10 +0000
committerGogs <[email protected]>2017-12-13 05:21:10 +0000
commitd23e4b43b0d6474a141fba4f804133edf4e6a37a (patch)
treedbaec95e074fde9bdc94c21ad2b4ceed080a7e78
parentc463a95dca0a5f2fbcdc1b67fd97f8c1159523f5 (diff)
parent3ee48ac83061ad205f42547f0f476db7a5243120 (diff)
Merge branch 'readability-urls' of JustAMacUser/tt-rss into master
-rwxr-xr-xplugins/af_readability/init.php9
1 files changed, 7 insertions, 2 deletions
diff --git a/plugins/af_readability/init.php b/plugins/af_readability/init.php
index 192ad90b6..fbc8fe0ab 100755
--- a/plugins/af_readability/init.php
+++ b/plugins/af_readability/init.php
@@ -154,6 +154,8 @@ class Af_Readability extends Plugin {
if (strpos($content_type, "text/html") === FALSE)
return false;
+
+ $effective_url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
}
$tmp = fetch_file_contents($url);
@@ -164,6 +166,9 @@ class Af_Readability extends Plugin {
if (!$tmpdoc->loadHTML('<?xml encoding="utf-8" ?>\n' . $tmp))
return false;
+ if (!isset($effective_url))
+ $effective_url = $url;
+
if (strtolower($tmpdoc->encoding) != 'utf-8') {
$tmpxpath = new DOMXPath($tmpdoc);
@@ -184,13 +189,13 @@ class Af_Readability extends Plugin {
foreach ($entries as $entry) {
if ($entry->hasAttribute("href")) {
$entry->setAttribute("href",
- rewrite_relative_url($url, $entry->getAttribute("href")));
+ rewrite_relative_url($effective_url, $entry->getAttribute("href")));
}
if ($entry->hasAttribute("src")) {
$entry->setAttribute("src",
- rewrite_relative_url($url, $entry->getAttribute("src")));
+ rewrite_relative_url($effective_url, $entry->getAttribute("src")));
}