url icon doesn't work on other pages as front page if [clean urls] are used

the.tdd - January 9, 2008 - 11:39
Project:URL Icon
Version:HEAD
Component:Code
Category:bug report
Priority:critical
Assigned:sanduhrs
Status:closed
Description

url icon doesn't work on other pages but front page if clean urls (by example, node/11) are used!
The icons are referring on non-existing directory in node/files/.../....ico instead of files/.../....ico.

I solved that with this patch (urlicon.module):

Instead of

// check for favicon availability                                                                        
  $favicon = file_exists($dir .'/'. $domain .'.ico') ? ($dir .'/'. $domain .'.ico') : (drupal_get_path('module', 'urlicon') .'/favicon.ico');

I'm using this code and it seems to works fine.

// check for favicon availability                                                                        
  $favicon = file_exists($dir .'/'. $domain .'.ico') ?                                                     
    dirname($_SERVER['PHP_SELF']).'/'.$dir .'/'. $domain .'.ico'                                           
    :                                                                                                      
    dirname($_SERVER['PHP_SELF']).'/'.(drupal_get_path('module', 'urlicon') .'/favicon.ico');

#1

sanduhrs - January 9, 2008 - 13:39

This behaviour seems to occur, when Drupal is installed in a subdirectory.

Changed line 144 from

<?php
$favicon
= file_exists($dir .'/'. $domain .'.ico') ? ($dir .'/'. $domain .'.ico') : (drupal_get_path('module', 'urlicon') .'/favicon.ico');
?>

to
<?php
$favicon
= file_exists(base_path().$dir .'/'. $domain .'.ico') ? (base_path().$dir .'/'. $domain .'.ico') : (base_path().drupal_get_path('module', 'urlicon') .'/favicon.ico');
?>

and commited to HEAD and DRUPAL-5.
Thanks.

#2

sanduhrs - January 9, 2008 - 13:46
Version:5.x-1.3» HEAD
Assigned to:the.tdd» sanduhrs
Status:needs review» fixed

done.

#3

Anonymous (not verified) - January 23, 2008 - 13:52
Status:fixed» closed

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

#4

csc4 - February 18, 2008 - 11:23
Priority:normal» critical
Status:closed» active

I think this patch is not quite right.

I've not used earlier versions so did a download and install - and I use subdirectories.

The problem is the module appeared not to work - I only ever saw the default favicon.ico (though the icon's were being correctly downloaded)

I've traced it to:

$favicon = file_exists(base_path().$dir .'/'. $domain .'.ico') ? (base_path().$dir .'/'. $domain .'.ico') : (base_path().drupal_get_path('module', 'urlicon') .'/favicon.ico');

which I think should be

  $favicon = file_exists($dir .'/'. $domain .'.ico') ? (base_path().$dir .'/'. $domain .'.ico') : (base_path().drupal_get_path('module', 'urlicon') .'/favicon.ico');

i.e. adding the basepath to the dir - base_path().$dir - stops the file exists test working.

I've marked it as critical as with the code as it currently stands I'm not sure it's working for anyone using the downloaded version?

I'm also finding the themeing appears to remove the space to the work after the link? (though that's obviously a minor point)

#5

sanduhrs - February 18, 2008 - 12:32
Status:active» needs review

It seems you're right.
Please try the attached patch.

AttachmentSize
urlicon_path_01.patch 901 bytes

#6

csc4 - February 18, 2008 - 17:06

Thanks for the quick response - can confirm the patch works for me for clean urls and subdirectories

#7

sanduhrs - February 18, 2008 - 17:09
Status:needs review» fixed

Commited to DRUPAL-5 and HEAD.
Thanks.

#8

Anonymous (not verified) - March 3, 2008 - 17:12
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.