Closed vemv closed 6 years ago
This should be fixed with #196
Thanks - will try it in production this week!
I'd be good to keep the issue open until we check it works. Then a snippet could be added to the documentation.
I think it'll work fine but I can't check it at the moment (https://github.com/dwilkie/carrierwave_direct/issues/206), will retry later.
In any case, a gem version bump is needed for this feature!
I could try it now. It doesn't work, request will fail with 403:
<Error>
<Code>AccessDenied</Code>
<Message>Invalid according to Policy: Policy Condition failed: ["eq", "$response-content-disposition", "inline"]</Message>
<RequestId>yyyyy</RequestId>
<HostId>xxxxxx</HostId>
</Error>
This is the relevant ruby code I wrote:
@uploader.policy do |conditions|
conditions << {"response-content-disposition" => "inline"}
end
Maybe S3 policies really don't have to do with setting content-disposition?
Content-disposition should not be set when uploading. You can pass it to the download url:
model.attachment.url(:query => { 'response-content-disposition' => 'attachment' } )
Similar gems let you do the following:
@uploader.add_field('Content-Disposition', 'inline')
I don't see an API to add custom fields to be taken into account by S3?
Cheers - Victor