When the CSS mode for GeSHi filter is set to external, the function _geshifilter_generate_languages_css() generates the external style sheet in the file_directory_path() .'/geshifilter'; directory. Next, the name of the file is generated with an MD5 hash of the enabled languages, e.g. geshifilter-languages-c4204877.css. The reference to that file, which is the filesystem path, is stored in the geshifilter_languages_css variable. In my case, where I use private file downloads, the file is in: /data/www/files/geshifilter/geshifilter-languages-c4204877.css. Note that this is the filesystem path, relative to the root of the filesystem.
In the function geshifilter_menu this file is added to the list of Drupal css files with: drupal_add_css($stylesheet_file);, where $stylesheet_file has the value of the geshifilter_languages_css variable. The description of the drupal_add_css says that the path should be given relative to the base_path(). The GeSHi Filter module however gives the filesystem path to the file in case of private file downloads. When I look in the generated page source, the link to the GeSHi filter external language css file is: //data/www/files/geshifilter/geshifilter-languages-c4204877.css, which is a file system path (relative to the server root), and not relative to the base_path() of the website.
The solution is to generate the path to the external language css file relative to base_path(). In case of private downloads this should be something like: system/files/geshifilter/geshifilter-languages-c4204877.css (note that a forward slash will be prepended by the drupal_add_css function later on). For private downloads you also need to tell Drupal that the file files/geshifilter/geshifilter-languages-c4204877.css can be accessed by anonymous users. I'm not sure how this works, but if you don't do it, you won't get access to it, even if you refer to its location correctly.
Comments
Comment #1
soxofaan commentedThis is a problem that also occurred with Drupal's CSS preprocessing and the theme coloring with color module:
http://drupal.org/node/100516
http://drupal.org/node/92059
The solution in both cases (for drupal 5) was to disable the feature when private downloads are enabled, because of the problem of anonymous users (who typically do not have the "view uploaded files" permission).
So I guess I'll have to disable the "CSS classes and external CSS style sheet." option in GeSHi filter when downloads are private.
I'll have to look if this solution is also required for Drupal 6.
Comment #2
soxofaan commented"CSS classes and external CSS style sheet." is now disabled when downloads are private:
http://drupal.org/cvs?commit=96301
needs to be ported to/solved for Drupal 6 version
Comment #3
soxofaan commentedported to Drupal 6:
http://drupal.org/cvs?commit=96305
(command line problem messed up commit message)
Comment #4
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.