6

I would like to download some files uploaded on my S3 Server.

For the moment, all my buckets and files inside them are public, so I can download what I want. Unfortunately, I can't access to files using special characters like a space or "&"...

I tried to change the special characters in my URL by HTML code :

http://s3-eu-west-1.amazonaws.com/custom.bucket/mods/b&b.jar

by

http://s3-eu-west-1.amazonaws.com/custom.bucket/mods/b%26b.jar

But I always have the same error :

<Error>
    <Code>AccessDenied</Code>
    <Message>Access Denied</Message>
    <RequestId>3E987FCE07075166</RequestId>
    <HostId>
        O2EIujdbiAeYg44rsezQlargfT7qVSL8SpqbTxkd/1UwxQrwZ3SJ+R3NlHyGF7rI
    </HostId>
</Error>

Anybody could resolve this problem ?

I can't rename them because there are used by other applications.

jbltx
  • 1,255
  • 2
  • 19
  • 34

3 Answers3

5

I am able to download public files with '&' in the name with no problems using curl:

curl https://s3.amazonaws.com/mybucket/test/b%26b.jar

Recheck the permissions on your file using the AWS console. Make sure the file has "Grantee: Everyone", and Open/Download permissions clicked, as in this screenshot:

AWS Console Screenshot

Make sure to click the "save" button after you add these credentials. Alternatively, try using your security credentials.

lreeder
  • 12,047
  • 2
  • 56
  • 65
  • The "Access Denied" error, instead of "Not Found" probably means that your URL is okay, but you don't have permission to get the file. The instructions in this answer should solve that. – Charles Engelke Nov 30 '13 at 15:56
  • 2
    @CharlesEngelke not necessarily. Unless the bucket has the appropriate permissions then it will return 403 on nonexistent objects because an unauthorized user does not technically have permission to know whether or not the object even exists. I only ever grant public read at the object level, even when everything in the bucket is going to be public, and my "not found" events always return 403... so 403 vs 404 is not a reliable indicator of object existence without knowing the overall config. – Michael - sqlbot Nov 30 '13 at 20:13
  • My bad, I didn't well create the permission. It's because I try to generate a similar XML file like S3 bucket for my server, but doesn't work on mine :/ – jbltx Dec 01 '13 at 13:25
0

I am able to download file with special character:

# wget --no-check-certificate https://s3-us-west-2.amazonaws.com/bucket1234/b%26b.jar
--2013-12-01 14:15:20--  https://s3-us-west-2.amazonaws.com/bucket1234/b%26b.jar
Resolving s3-us-west-2.amazonaws.com... 54.240.252.26
Connecting to s3-us-west-2.amazonaws.com|54.240.252.26|:443... connected.
WARNING: certificate common name `*.s3-us-west-2.amazonaws.com' doesn't match requested host name `s3-us-west-2.amazonaws.com'.
HTTP request sent, awaiting response... 200 OK
Length: 0 [application/x-java-archive]
Saving to: `b&b.jar'

    [ <=>                                                                             ] 0           --.-K/s   in 0s      

2013-12-01 14:15:22 (0.00 B/s) - `b&b.jar' saved [0/0]

Are you sure that this file is "Publicly visible"? could you double check the permissions for this file ? This is definitely not an issue with the special character.

slayedbylucifer
  • 22,878
  • 16
  • 94
  • 123
0

Can you just login to aws s3 console and check what download link shows there?

Is there any mismatch in the link because of double encoding? Please make sure you are not doing any URL encoding from your code while uploading file.

In your case it could be:

http://s3-eu-west-1.amazonaws.com/custom.bucket/mods/b%2526b.jar

Nitish Raj
  • 137
  • 1
  • 2
  • 12