Closed (fixed)
Project:
AmazonS3
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
23 Jun 2011 at 00:08 UTC
Updated:
21 Apr 2012 at 02:18 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
Aracon commentedExcuse me, of course not "copy the link to the video and download it", but "copy the link to the video and publish it on another site, so anyone can download it".
Comment #2
justafishComment #3
rfayThe attached patch allows AmazonS3 to take advantage of a number of S3 features, including:
* Authenticated links (links with a timeout). You can specify how long a link will be valid.
* Torrent links. Rather than a straight HTTP download, a torrent is provided instead
* Forcing save-as (forcing download). The Content-disposition HTTP header is used to force the browser to try to save the file.
In addition, a new hook, hook_amazons3_url_info() is exposed to allow other modules to participate in setting the features above. For example, authenticated links can be required for some users, some not; Forcing save-as can be done for some filetypes and not others.
Here is the revised configuration page:

Comment #4
rfayMarked #1222522: Force Files to Download - not open in browser. as duplicate.
Comment #5
justafishThis kind of configuration would be better as part of the individual file fields so we don't have weird situations such as aggregated CSS being delivered via torrent. Here's a half-finished patch which illustrates the configuration form part of it.
Comment #6
justafishoops, ignore that last function
Comment #7
justafishThe only way I can think of doing this is using hook_file_url_alter, then checking whether the URI is in use by a field and whether it has any special settings and then some kind of nasty hack to pass it to getExternalURL()
So I'm thinking that although this would be nicer from a UI perspective to be in the field configuration, it's not very practical and will cause a fair bit of unnecessary overhead. So rfay's patch is much more useful than mine ;)
What I would like to see on it though, is instead of radio buttons for Torrent/HTTP is a path configuration textarea for which URLs should be delivered that way. Also a warning that the pre-signed URL needs to have a longer timeout that the anonymous page cache otherwise we'll get some weirdness.
Comment #8
keva commentedApplied the patch in #3 to the September 1, 2011 dev release. (which meant applying the first hunk to line 116 of AmazonS3StreamWrapper.inc instead of 66; the other hunks appeared to work automatically)
settings:
correct bucket name used
HTTP checked
Only "Create presigned authenticated URL with timeout" is checked
when I edit or add a node with a Video Upload field, get these notices:
Perhaps this was due to creative patching? If so, is it possible to re-roll the patch for the latest dev?
Also, the project shortname changed some time between the patch in #3 and the 9/1/11 dev release.
If that affects anything.
Comment #9
justafishPatch attached.
I've commented out chmod functionality, it was setting the ACL on objects but since we're going to want to use presigned URLs I'm not sure that's such a good idea.
Comment #10
justafish+ api doc
Comment #11
justafishcommitted.