Install a fresh site with standard settings.
Enable private files.
Install google fonts.
Doesn't work, recent log messages show:
page not found 03/24/2011 - 22:06 system/files/google_fonts/google_fonts.css
for both anonymous and authenticated users.

Comments

azman’s picture

The public file location was set to:
sites/[domain]/files/public

The private file location was set to:
sites/[domain]/files/private

I can confirm that the google_fonts.css file has been created in:
sites/[domain]/files/private/google_fonts/google_fonts.css

The URI used to access the css file is:
/system/files/google_fonts/google_fonts.css?lik6ts

Copying the file to either directory has no effect.

azman’s picture

Changing the default download method to public does fix the problem.

BarisW’s picture

Hmm, weird. Thanks for reporting and giving me all the info. I'd wish more people were this accurate with testing and reporting ;)

It seems that if I change the private directory from 'sites/[domain]/files/private' to something like '/Users/BarisW/Sites/some_dir/' (outside the Drupal installation) it works.

This is the code that I use to generate the file. If you see any strange things, please let me know:

  $directory = file_build_uri('google_fonts');
  $file_destination = $directory . '/google_fonts.css';
  
  if ((!file_exists($file_destination) || $reset) && !empty($file_contents)) {
    
    $file_contents = '/* CSS code for the Google Fonts module */' . PHP_EOL . $file_contents;
    
    // Check that the files directory is writable
    if (file_prepare_directory($directory, FILE_CREATE_DIRECTORY)) {
      return file_unmanaged_save_data($file_contents, $file_destination, FILE_EXISTS_REPLACE);
    }
BarisW’s picture

I was wrong. Even with absolute paths, I get a 404 when opening the generated path. I'll investigate further!

BarisW’s picture

Status: Active » Fixed

I've set the path to public, as the Color module in Drupal7 core does this as well. Fixed in 7.x-2.0-alpha1

azman’s picture

No problems, thanks for fixing the bug =)

Colorful Tones’s picture

Priority: Major » Minor

I was obtaining same bug in error log. I also had same exact file path setup as @azman. I tried upgrading to alpha version and got
Fatal error: Cannot unset string offsets in /public_html/sites/[domain]/modules/google_fonts/google_fonts.module on line 135

I also noticed that when I updated to alpha there was no option to enable 'Google Font UI' on the Modules tab, but only the option to enable 'Google Font' module. Not sure if this was intended?

Last, I can confirm that my changes were being saved in /public/google_font/google_fonts.css when running current stable: 7.x-1.6

BarisW’s picture

Hi Colorful. So there seems to be a problem with the upgrade path.
The Google Fonts UI module now has been integrated. So instead of 2 modules, I now have one module.

I'll investigate!

Status: Fixed » Closed (fixed)
Issue tags: -private files

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