Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'#' in S3 key/"path" #68

Closed
mentalisttraceur opened this issue May 20, 2015 · 5 comments
Closed

'#' in S3 key/"path" #68

mentalisttraceur opened this issue May 20, 2015 · 5 comments
Labels

Comments

@mentalisttraceur
Copy link

In an S3 bucket, I have a folder like so: #foo

I am trying to upload a file to it, e.g. put a file with local pathname /tmp/bar into the key #foo/bar

$my_bucket_name contains only alpha-numerics and the - character.

[notroot@aio14 ~]$ touch /tmp/bar
[notroot@aio14 ~]$ cat /tmp/bar | gof3r put -b "$my_bucket_name" -k \#foo/bar
gof3r error: 412: "At least one of the pre-conditions you specified did not hold"
[notroot@aio14 ~]$ gof3r cp /tmp/bar s3://"$my_bucket_name"/#foo/bar
gof3r error: 400: "A key must be specified"
[notroot@aio14 ~]$ 
[notroot@aio14 ~]$ gof3r cp /tmp/bar s3://"$my_bucket_name"/foo/bar
duration: 770.022417ms
[notroot@aio14 ~]$ cat /tmp/bar | gof3r put -b "$my_bucket_name" -k foo/bar
duration: 760.235401ms
@mentalisttraceur
Copy link
Author

I accidentally hit the submit-issue keyboard shortcut early, so I've updated my comment above slightly with the rest of the details.

Also, I've tried passing a backslash as part of the argument (appropriately escaped for the BASH shell I'm running this from to not swallow it, of course) and it seemingly works at first, but actually only uploads it with the S3 key/"path" \.

@rlmcpherson
Copy link
Owner

Thanks, I've confirmed it's an issue with #. I believe it may be related to golang/go#5684 but I'll have to look into it. Apparently there is a documented workaround.

@mentalisttraceur
Copy link
Author

Thank you for the prompt reply. Looking forward to any fix you may be able to do on your end. In the meantime, I have found that you can make it work with the put command by manually urlencoding the # to %23, but not in the cp command:

[notroot@aio14 ~]$ cat /tmp/bar | gof3r put -b "$my_bucket_name" -k %23foo/bar
duration: 813.469231ms
[notroot@aio14 ~]$ gof3r cp /tmp/bar s3://"$my_bucket_name"/%23foo/bar
gof3r error: 412: "At least one of the pre-conditions you specified did not hold"
[notroot@aio14 ~]$ 

@mentalisttraceur
Copy link
Author

Current workaround for put [edit1]I meant cp[/edit1] is to double-escape the hash # -> %23 -> %2523

[notroot@aio14 ~]$ gof3r cp /tmp/bar s3://"$my_bucket_name"/%2523foo/bar
duration: 671.522641ms

@venkatnaidu
Copy link

venkatnaidu@venkiadmin-Vostro-460:~/go/bin$ gof3r cp /home/venkatnaidu/Desktop/prac/xxlarge.jpg s3://wed-test-upload
gof3r error: 400: "A key must be specified"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants