diff --git a/classes/rssutils.php b/classes/rssutils.php index ea57e6466..28bdda78b 100755 --- a/classes/rssutils.php +++ b/classes/rssutils.php @@ -1612,7 +1612,7 @@ class RSSUtils { } } - private static function is_gzipped($feed_data) { + static function is_gzipped($feed_data) { return mb_strpos($feed_data, "\x1f" . "\x8b" . "\x08", 0, "US-ASCII") === 0; } diff --git a/include/functions.php b/include/functions.php index 1d83a41da..24c251bd3 100755 --- a/include/functions.php +++ b/include/functions.php @@ -437,6 +437,14 @@ curl_close($ch); + $is_gzipped = RSSUtils::is_gzipped($contents); + + if ($is_gzipped) { + $tmp = @gzdecode($contents); + + if ($tmp) $contents = $tmp; + } + return $contents; } else { @@ -522,6 +530,15 @@ return false; } + + $is_gzipped = RSSUtils::is_gzipped($data); + + if ($is_gzipped) { + $tmp = @gzdecode($data); + + if ($tmp) $data = $tmp; + } + return $data; } diff --git a/plugins/af_readability/init.php b/plugins/af_readability/init.php index 339cc20d2..273f3d46b 100755 --- a/plugins/af_readability/init.php +++ b/plugins/af_readability/init.php @@ -148,6 +148,7 @@ class Af_Readability extends Plugin { } public function extract_content($url) { + global $fetch_effective_url; $tmp = fetch_file_contents([ @@ -158,7 +159,7 @@ class Af_Readability extends Plugin { if ($tmp && mb_strlen($tmp) < 1024 * 500) { $tmpdoc = new DOMDocument("1.0", "UTF-8"); - if (!$tmpdoc->loadHTML('\n' . $tmp)) + if (!$tmpdoc->loadHTML($tmp)) return false; if (strtolower($tmpdoc->encoding) != 'utf-8') {