I use file entity together with media_youtube module and it seems that download formatter does not work well when I a user try to download a youtube video. Actually there is nothing to download and I think that correct behavior of the formatter will be to skip all the external files.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

boyan.borisov’s picture

Status: Active » Needs review
FileSize
626 bytes

I've made a patch which will skip all the files with filesize == 0 from the download formatter.

Devin Carlson’s picture

Thanks for the patch!

We should be able to use the file_entity_file_is_local() function to determine if the file is local.

Devin Carlson’s picture

Status: Needs review » Fixed

Tested and confirmed that #2 restricted the download formatter to local files which resulted in it no longer being chosen to render remote files that can't be downloaded. I also checked to make sure that it would still be available to modules like Remote Stream Wrapper.

Committed #2 to File Entity 7.x-2.x.

xcf33’s picture

Hi

I ran into similar issue with this but more so with the download link views handler,

I think a different approach to this would be to not only restrict (file_entity_file_is_local($file)) because there are many use cases where local file directory is not used (Amazon S3, Rackspace cloud files, etc)

I have attached 2 patches, one illustrate by using a simple hook we can allow modules to declare probably either schemes not allowed (youtube, vimeo, etc).

xcf33’s picture

xcf33’s picture

Status: Fixed » Closed (fixed)

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

pianomansam’s picture

While the applied patch fixes the download link for external files, I'm not sure it does it the best way. I've discovered at least one bug that is caused by this patch - #2276437: External files using download formatter lose custom link text. Please see that issue with a different proposed patch that still fixes this issue but doesn't cause adverse side effects.