Enclosure URL path not working for private files?
| Project: | FileField Podcaster |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | mfer |
| Status: | active |
I'm new to Drupal, and the regular newbie baggage applies... I'm a geek, but have only played with Drupal for a few weeks, please pardon my probably incorrect use of terms, etc.
I cannot force FileField Podcaster to recognize private files path (/system/files/) for the ENCLOSURE link; It seems to default to the system path, in my case: http://mikewren.com/sites/default/files/podcast/newbienet2008-05-18_0.mp3
I tried making files public, to no avail. I tried adding the following to settings.php without success:
$conf = array(
'swftools_media_url' => 'http://mikewren.com/system/files/podcast', // No trailing slashes!
);Also, the 1pixel player can't seem to see the local media files either, I'm not sure if it's related to the path issue also.
Here's an example URL: http://mikewren.com/node/97
With so many modules having dependancies, it's hard to track down where the issue is occurring, in FFPC, Views, Content Type, etc.
I'm out of ideas, and not sure how to proceed in my troubleshooting. Thanks for your efforts, I feel like I'm so close to the endzone here...

#1
It's necessary to call file_create_url() in order to support sites with private filesystems.
A patch is attached.
#2
Fantastic, thank you so much! Swapped out those two lines and the Feed now lists the private filesystem URL as expected. I Hope these changes make it into the official release.
#3
This is on my plate to handle. I'm looking at fixing an issue with the guid for those coming from the audio module.
#4
This has been committed to head. Please test and let me know if there are any issues.
#5
#6
Automatically closed -- issue fixed for two weeks with no activity.
#7
You also need to adjust the url for the enclosure tag as well.
starting at about line 85 in HEAD
Currently...
$file_extra[] = array('key' => 'enclosure',
'attributes' => array(
'url' => url( $file['filepath'], array('absolute'=>TRUE) ),
'length' => $file['filesize'],
'type' => $file['filemime'],
),
);
should be...
$file_extra[] = array('key' => 'enclosure',
'attributes' => array(
'url' => file_create_url($file['filepath']),
'length' => $file['filesize'],
'type' => $file['filemime'],
),
);
Enclosures offer the raw url when file system is set to private.
This will bypass any modules which use hook_file_download().
If the web server has been set to restrict access (which mine has) to the /files folder directly, then no files are transferred because of the bypass of file.inc's creation of the correct file url path.