From d4a7074294d9e2a3c58d61b9fd0a078430446ace Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sun, 17 May 2009 10:42:16 +0000 Subject: [PATCH] - Patch #415710 by dixon_, JohnAlbin, BMDan: fix favicon mime-type handling. --- includes/file.inc | 2 +- includes/theme.inc | 8 +++++++- includes/theme.maintenance.inc | 8 +++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/includes/file.inc b/includes/file.inc index 58b3e1b2014..a8aaf984843 100644 --- a/includes/file.inc +++ b/includes/file.inc @@ -1798,7 +1798,7 @@ function file_get_mimetype($filename, $mapping = NULL) { 'cdr' => 'image/x-coreldraw', 'pat' => 'image/x-coreldrawpattern', 'cdt' => 'image/x-coreldrawtemplate', - 'ico' => 'image/x-icon', + 'ico' => 'image/vnd.microsoft.icon', 'art' => 'image/x-jg', 'jng' => 'image/x-jng', 'bmp' => 'image/x-ms-bmp', diff --git a/includes/theme.inc b/includes/theme.inc index 66f82caafe2..1a8dd174758 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -1769,7 +1769,13 @@ function template_preprocess_page(&$variables) { // Add favicon. if (theme_get_setting('toggle_favicon')) { - drupal_add_html_head(''); + $favicon = theme_get_setting('favicon'); + $type = file_get_mimetype($favicon); + // Use the genereic MIME type for favicons if no other was found. + if ($type == 'application/octet-stream') { + $type = 'image/x-icon'; + } + drupal_add_html_head(''); } // Set up layout variable. diff --git a/includes/theme.maintenance.inc b/includes/theme.maintenance.inc index 92fefeece28..d36ad3950d7 100644 --- a/includes/theme.maintenance.inc +++ b/includes/theme.maintenance.inc @@ -206,7 +206,13 @@ function theme_update_page($content, $show_messages = TRUE) { function template_preprocess_maintenance_page(&$variables) { // Add favicon if (theme_get_setting('toggle_favicon')) { - drupal_add_html_head(''); + $favicon = theme_get_setting('favicon'); + $type = file_get_mimetype($favicon); + // Use the genereic MIME type for favicons if no other was found. + if ($type == 'application/octet-stream') { + $type = 'image/x-icon'; + } + drupal_add_html_head(''); } global $theme;