Download & Extend

Incompatible with private files

Project:URL Icon
Version:5.x-1.5
Component:Code
Category:bug report
Priority:normal
Assigned:sanduhrs
Status:closed (fixed)

Issue Summary

I used the following code to work on a site with private files:

   // check for favicon availability
-  $favicon = file_exists($dir .'/'. $domain .'.ico') ? (base_path().$dir .'/'. $domain .'.ico') : (base_path().drupal_get_path('module', 'urlicon') .'/favicon.ico');
+  $favicon = file_exists($dir .'/'. $domain .'.ico') ? (file_create_url($dir .'/'. $domain .'.ico')) : (base_path().drupal_get_path('module', 'urlicon') .'/favicon.ico');
  
   $link = theme_urlicon($match[3], $favicon, $match[1], array('alt' => '', 'title' => t('favicon'), 'class' => 'urlicon ui-'. $domain));
   return $link;
@@ -154,3 +154,12 @@
   $favicon = '<img src="'. $favicon .'" '. drupal_attributes($attributes) .' />';
   return l($text .' '. $favicon, $path, array(), NULL, NULL, TRUE, TRUE);
}
+
+function urlicon_file_download($filepath) {
+  // Check if the file is controlled by the current module.
+  if (strpos($filepath, 'urlicon') !== FALSE) {
+    if (user_access('access content')) {
+      return array('Content-type: image/png');
+    }
+  }
+}

Comments

#1

Oops, I see I left the specific content-type in there; that needs to be made sensitive to the type of file being stored...

#2

Assigned to:Anonymous» sanduhrs
Status:active» fixed

Commited to 5,6,HEAD
Thanks.

#3

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.