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
Comments
Comment #1
merlinofchaos commentedCrap. 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.
Comment #2
merlinofchaos commentedI was looking at color.module to see how it handles this...and as near as I can tell, it doesn't handle this either.
Comment #3
stella commentedYeah, and you can't optimize/compress css files in Drupal when using a private file system either. :(
Comment #4
merlinofchaos commentedIt 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.
Comment #5
crea commentedAFAIK 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 :-)
Comment #6
merlinofchaos commentedThere is no way to combine private/public in Drupal, which is a problem.
Comment #7
crea commentedIt 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.
Comment #8
elijah lynnBummer, 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.
Comment #9
decipheredNot 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*
Comment #10
merlinofchaos commentedDeciphered: There is unlikely to be a fix in Drupal 6. Alas, CTools derived modules are likely to be incompatible with the private file system. :/
Comment #11
deciphered@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.
Comment #12
DrupalCuckoo commentedhi,
I'm experiencing the same problem and I can't find any solution. Is there now a solution for this problem or do I have to work with "public file system"?
Thanks.
PS: I'm sorry if I've selected the wrong Status/Category/Priority. I wasn't sure what to select.
Comment #13
steinmb commentedHave the same issue though I only need to protect a single directory. I stumble upon this article in the IRC channel. http://www.drupalcoder.com/story/406-mixing-private-and-public-downloads.... This might be a solution, at least for me. By doing this are still keeping the public mode but are able to run this redirect through Drupal's access system.
Anyone seeing any security problems with this hack?
Comment #14
merlinofchaos commentedThere are some experimental changes in the latest CTools -dev that might actually work with private file systems. They are experimental and I don't remember if they are complete, though.
Comment #15
Anonymous (not verified) commentedDid any one ever see if this works? We just published our development site, and discovered this issue. It's just one CSS file that can't be found...
Comment #16
merlinofchaos commentedOk, I've verified that I needed to implement an additional hook in CTools to get this to work:
I checked this into CTools but if you just add that to the end of ctools.module I think private file systems will work.
I noticed Panels was trying to use CSS caching incorrectly in a couple of spots, so rounded corners and flexible.inc need updates too (I checked those in as well).
Comment #18
iva2k commentedSorry to reopen, but it is still broken. The CSS files are served, but as "application/x-download" type (in my setup it was thanks to IMCE.module's default clause in imce_file_download()). That makes Firefox and Chrome just ignore CSS files.
I baked this solution in few minutes:
The corners are back with the above.
@merlinofchaos, maybe you can roll a .CSS type check like this into CTools?
Comment #19
merlinofchaos commentedCTools has this code:
That should work just fine for text/css unless file_get_mimetype() somehow fails. I've tested this previously and it was working, so I'm not sure what's wrong for you. Your code hardcodes the .css stuff, but file_get_mimetype() should be working here. I would need some debug information to explain why this code is not working to implement any kind of hardcoding.
Comment #20
iva2k commentedThanks for the pointer, I looked into file_get_mimetype - it does indeed return text/css for .css files.
I also reviewed other modules, and IMCE was screwing up by adding application/x-download in its else statement, but it was old version of IMCE. So I updated IMCE, and newer version has added file_get_mimetype clause now, so it works fine after the update.
I don't know if "authoritative" statement in content-type would have made any difference (Content-Type: text/css; authoritative=true).
Back to closed.
Comment #21
Anonymous (not verified) commentedI have a similar problem (http://drupal.org/node/1337122#comment-5231398).
The issue is appearing since PHP 5.3 (PHP 5.2 works properly).
Using:
- Panels 6.x-3.x-dev (2011-set-21)
- Chaos tool suite (ctools) 6.x-1.x-dev (2011-ott-01)
Can you help me?
Comment #22
decipheredgiorez,
This issue has been closed for almost a year, please don't re-open it, instead create a new issue and if you think anything in this issue is relevant then link to it.
Cheers,
Deciphered.
Comment #23
merlinofchaos commentedReopening a 1 year old issue to do nothing other than point to another already open issue is wrong. Multiple issues for the same problem duplicates effort and creates confusion. Doing this is a great way to upset anyone who might be able to help you. Don't do it.
Comment #24
Anonymous (not verified) commentedok, sorry for it. I didn't realized.