Closed (fixed)
Project:
File Force Download
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
1 Feb 2011 at 12:35 UTC
Updated:
3 Aug 2012 at 20:31 UTC
Jump to comment: Most recent file
Comments
Comment #1
arski commentedHey,
Yes, I'm afraid FF only works with the private download method enabled at the moment (see readme).
I wasn't really sure if I wanted to make it work with the public download method, because by definition, it's impossible. The public download methods means that files are downloaded directly from the server, i.e. without Drupal doing anything at all.. and making FF work with that means creating a formatter with a custom-defined URL path that goes around the download method setting completely, which doesn't seem to make too much sense to me.
Anyway, would be interesting to hear some people's thought on this.
Cheers
Comment #2
e5sego commentedWorkaround
It is possible to use FF with public file method if you setup your webserver to add special mime type header if download=1 get-parameter is present. For apache this can be done by adding following lines to .htaccess file in root of public download folder (or main install folder):
Now you can use FF module or simply add ?download=1 to file url's in your theming code.
Comment #3
justinlevi commentedThanks for the htaccess rule. That was exactly what I was looking for.
Comment #4
arski commentedFile Force Download module itself will not be providing support for the public download method in D7 due to the reasons outlined above, namely that a public method does not go through the Drupal stack and hence shouldn't be messed with.
A .htaccess solution is not as lean maybe, but you're always more than welcome to go for it.
Comment #5
lee20 commentedNot sure why you wouldn't just reroute public files through the system.
Here is a patch that makes FF work with public files.
This adds a menu callback so that public files can be sent through the routing system. The menu path is configurable but there is no admin for this. If there is interest, I can add this.
Comment #6
arski commentedWell, this is exactly what the D6 version of the module does. If I remember correctly, I have tested the D6 approach in D7 and ran into some issues there, mainly with the files simply not being found as they were placed in different storage depending on what download method the site uses..
Have you actually tested your patch and can confirm that it works for you?
Comment #7
lee20 commentedYes I have tested it and it works great. It merely detects and overrides the URLs for public files and should have no impact on private files.
Comment #8
arski commentedAlright, I'll take a look at porting the D6 code back in for consistency, as I said, it is almost identical to your patch.
Comment #9
lee20 commentedAwesome. There is one thing I just noticed. My patch didn't account for the the call to file_create_url() in the file_force_formatter.inc file. I would provide another patch but since your going to port it just thought I'd point this out.
Comment #10
arski commentedYeah, I'll go through everything again anyway, thanks.
Comment #11
arski commentedAnd committed, lovely. I was originally reluctant about doing this approach, but what the hell. Enjoy :)