summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorGregor Tätzner <gregor@freenet.de>2012-07-22 10:41:39 +0200
committerGregor Tätzner <gregor@freenet.de>2012-07-22 10:41:39 +0200
commit2580eb06003aa3827106c9a5eb78348c333dabc8 (patch)
tree898d6b865b06ecb1d6c0686cf02d7a62a6a22c91 /lib
parent81e6a72a20e115ba8d11e23c0677a0915fedf3ff (diff)
Improve favicon file check
Diffstat (limited to 'lib')
-rw-r--r--lib/utils.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/utils.php b/lib/utils.php
index a20fc5be8..096a1211e 100644
--- a/lib/utils.php
+++ b/lib/utils.php
@@ -48,9 +48,11 @@ class OC_News_Utils {
if ($favicon == null) {
//handle favicon detection
$favicon = SimplePie_Misc::absolutize_url('/favicon.ico', $url);
-
- // FIXME check if file exists and is valid
- if (false === file_get_contents($favicon, 0, null, 0, 1))
+ // get file
+ $file = new SimplePie_File($favicon);
+ $sniffer = new SimplePie_Content_Type_Sniffer($file);
+ // check file
+ if(substr($sniffer->get_type(), 0, 6) !== 'image/')
$favicon = null;
}