diff options
author | Nicolas Frandeboeuf <nicofrand@gmail.com> | 2013-08-22 00:49:23 +0200 |
---|---|---|
committer | Nicolas Frandeboeuf <nicofrand@gmail.com> | 2013-08-22 00:49:23 +0200 |
commit | 2bf93dc0345e304656ed9a931f9941fd7117ddfe (patch) | |
tree | b1cd9e9df7ab8b5f072199455911476fb750bd05 | |
parent | 7ba37bd91a43321196e6d867caf9e298e82c6d6c (diff) | |
download | wallabag-2bf93dc0345e304656ed9a931f9941fd7117ddfe.tar.gz wallabag-2bf93dc0345e304656ed9a931f9941fd7117ddfe.tar.zst wallabag-2bf93dc0345e304656ed9a931f9941fd7117ddfe.zip |
Fix #149
-rw-r--r-- | inc/poche/Url.class.php | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/inc/poche/Url.class.php b/inc/poche/Url.class.php index 00b0b257..77ed5398 100644 --- a/inc/poche/Url.class.php +++ b/inc/poche/Url.class.php | |||
@@ -64,8 +64,15 @@ class Url | |||
64 | if (function_exists('tidy_parse_string')) { | 64 | if (function_exists('tidy_parse_string')) { |
65 | $tidy = tidy_parse_string($html, array(), 'UTF8'); | 65 | $tidy = tidy_parse_string($html, array(), 'UTF8'); |
66 | $tidy->cleanRepair(); | 66 | $tidy->cleanRepair(); |
67 | $html = $tidy->value; | 67 | |
68 | } | 68 | //Warning: tidy might fail so, ensure there is still a content |
69 | $body = $tidy->body(); | ||
70 | |||
71 | //hasChildren does not seem to work, just check the string | ||
72 | //returned (and do not forget to clean the white spaces) | ||
73 | if (preg_replace('/\s+/', '', $body->value) !== "<body></body>") | ||
74 | $html = $tidy->value; | ||
75 | } | ||
69 | 76 | ||
70 | $parameters = array(); | 77 | $parameters = array(); |
71 | if (isset($html) and strlen($html) > 0) | 78 | if (isset($html) and strlen($html) > 0) |