markevans / dragonfly-s3_data_store

S3 data store for the Dragonfly ruby gem
MIT License
62 stars 58 forks source link

Error accessing image width: 403 Forbidden #26

Closed jogaco closed 7 years ago

jogaco commented 8 years ago

Looks like bucket credentials are not presented when trying to fetch image attributes, like width.

2.1.7 :003 > i.image
 => <Dragonfly Attachment uid="2015/12/27/12/57/05/201cc3f4-ad94-47a7-ae4e-564f9964c8eb/141828108918.jpg", app=:default> 
2.1.7 :004 > i.image.width
Excon::Errors::Forbidden: Expected([200, 206]) <=> Actual(403 Forbidden)
excon.error.response
  :body          => "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>C5A217CF95695361</RequestId>

I can however assign a remote image and have it uploaded to S3 without a problem

jogaco commented 7 years ago

My mistake. Any Deny Bucket policy should not be applied to the CanonicalUser:

{
    "Sid": "Give not access if referer is no my sites",
    "Effect": "Deny",
     "NotPrincipal": {"CanonicalUser": "64-digit-alphanumeric-value"},
...