ctools css files don't load with private system

stella - June 29, 2009 - 10:54
Project:Chaos tool suite
Version:6.x-1.0-beta3
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:postponed
Description

I'm having a problem when using ctools when the file system is set to private. I had installed panels3 but noticed that the rounded corners weren't appearing. When I looked at the page source, it's because the ctools css files are being loaded like:

<link type="text/css" rel="stylesheet" media="all" href="//usr/local/vhost/6178/files/ctools/css/c6aa91d43a04049bf15f9e7bfccdf40f.css?B" />
<link type="text/css" rel="stylesheet" media="all" href="//usr/local/vhost/6178/files/ctools/css/80a950e3ce95fa11004fc9a7a8e1882c.css?B" />

where /user/local/vhost/6178/files is the path to my files directory which resides outside the main drupal installation. Changing it back to a public file system, with a Drupal relative files path, fixes the issue, but that isn't really an option for me at the moment.

I've also tried to access the css file directly via http://www.example.com/system/files/ctools/css/80a950e3ce95fa11004fc9a7a8e1882c.css but that just results in a page not found error, despite the fact that I access other files (pdf, jpg, gif) in the same manner. I think it may be because Drupal sets the mimetype to be application/x-download for files accessed via /system/files unless overridden in hook_file_download().

Perhaps this is an issue for each of the modules that call ctools_css_retrieve() as they call drupal_add_css(), I'll let you decide.

Cheers,
Stella

#1

merlinofchaos - July 17, 2009 - 21:34
Status:active» postponed

Crap. drupal_add_css() basically doesn't work with a private file system.

For now, I don't have a good solution beyond suggesting using .htaccess and rewriting the paths and using a symlink so that the files/ctools/css directory can be in a public location.

#2

merlinofchaos - July 17, 2009 - 21:35

I was looking at color.module to see how it handles this...and as near as I can tell, it doesn't handle this either.

#3

stella - July 17, 2009 - 22:06

Yeah, and you can't optimize/compress css files in Drupal when using a private file system either. :(

#4

merlinofchaos - July 17, 2009 - 23:20

It seems like there should be an alternative to do drupal_set_html_head if using a private filesystem, but that's going to require more than a quick fix to the css caching system for that to work.

#5

crea - July 20, 2009 - 15:42

AFAIK private fs is very broken in many aspects. When I tried to use it in 5.x I always had issues in one module or another. Basically, there is not much of testing of private fs in Drupal contrib modules, so you gonna have issues.
If I was you, I would go for some combination of public and private filesystems. Anyway private fs usually needed when you want to limit access to some private info (hence the name) and I doubt CSS files contain such information :-)

#6

merlinofchaos - July 20, 2009 - 15:51

There is no way to combine private/public in Drupal, which is a problem.

#7

crea - July 20, 2009 - 17:40

It seems there are workarounds for that: I remember reading about some module that implements it, probably it was some CDN implementation. But they may need core patching, dunno.

#8

Elijah Lynn - August 12, 2009 - 00:39

There is no way to combine private/public in Drupal, which is a problem.

Bummer, I was hoping to find a way to still use the "Optimize CSS and JS files" feature with the private file system but hearing this from your mouth is not good!

I searched Google for "drupal optimize css files with private files" and this was #1.

We have to use the private file system for one site and with 36 css files and 9 js files it sure would be nice to make use of this feature.

#9

Deciphered - October 27, 2009 - 02:06

Not a fan of people who subscribe with no useful input, but nor am I a fan of constant page not found errors clogging my access logs.

*subscribe*

#10

merlinofchaos - October 27, 2009 - 02:36

Deciphered: There is unlikely to be a fix in Drupal 6. Alas, CTools derived modules are likely to be incompatible with the private file system. :/

#11

Deciphered - October 27, 2009 - 03:07

@merlinofchaos.

That's ok, I did a bit of research as even Drupal core javascript translations suffer from this exact error so I can except it won't be fixed, I just wanted to tell myself that I was making some (if only half-assed) attempt to look into the issue instead of just accepting it.

 
 

Drupal is a registered trademark of Dries Buytaert.