X-Git-Url: https://git.wh0rd.org/?p=tt-rss.git;a=blobdiff_plain;f=plugins%2Faf_readability%2Finit.php;h=04673000a19240f56512f1e15050df6c62bd2d81;hp=10de118f9bbd31522410007345c26ff07285b42c;hb=f830f853a919c458d06bdc6ce292b8ae73a801f3;hpb=e2cb5e6cb91fbfa9f929b979855364bc8faa71e8 diff --git a/plugins/af_readability/init.php b/plugins/af_readability/init.php index 10de118f..04673000 100755 --- a/plugins/af_readability/init.php +++ b/plugins/af_readability/init.php @@ -155,6 +155,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); @@ -165,6 +167,9 @@ class Af_Readability extends Plugin { if (!$tmpdoc->loadHTML('\n' . $tmp)) return false; + if (!isset($effective_url)) + $effective_url = $url; + if (strtolower($tmpdoc->encoding) != 'utf-8') { $tmpxpath = new DOMXPath($tmpdoc); @@ -185,13 +190,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"))); }