]> git.wh0rd.org Git - tt-rss.git/commitdiff
limit maximum article length allowed for readability
authorAndrew Dolgov <noreply@madoka.volgo-balt.ru>
Tue, 6 Oct 2015 11:12:22 +0000 (14:12 +0300)
committerAndrew Dolgov <noreply@madoka.volgo-balt.ru>
Tue, 6 Oct 2015 11:12:22 +0000 (14:12 +0300)
plugins/af_readability/init.php
plugins/af_redditimgur/init.php

index 8914ba43aa7a83b731c5473db90a91662b23350b..cfdcb69d39a05418354dcf842ffd7d7087fdf0c3 100644 (file)
@@ -119,7 +119,7 @@ class Af_Readability extends Plugin {
 
                $tmp = fetch_file_contents($article["link"]);
 
-               if ($tmp) {
+               if ($tmp && mb_strlen($tmp) < 65535 * 4) {
                        $tmpdoc = new DOMDocument("1.0", "UTF-8");
 
                        if (!$tmpdoc->loadHTML($tmp))
index 9b3a999d30d864da7eea775ea9d3b980a12c9cc6..ded98d8cc04ce34d9a7bfcd35fb1c31fe94b94e1 100644 (file)
@@ -261,7 +261,10 @@ class Af_RedditImgur extends Plugin {
 
                                                $tmp = fetch_file_contents($content_link->getAttribute("href"));
 
-                                               if ($tmp) {
+                                               //_debug("tmplen: " . mb_strlen($tmp));
+
+                                               if ($tmp && mb_strlen($tmp) < 65535 * 4) {
+
                                                        $r = new Readability($tmp, $content_link->getAttribute("href"));
 
                                                        if ($r->init()) {