On Thu, Apr 15, 2021 at 7:01 PM nonnikcm <b...@compado.com> wrote:

> i am struggling with using the s3manager to create files on S3. the file
> names need to be in the following format "set=2012-04-3", containing an
> "=". uploading with out the "=" works perfectly...
> sess := session.Must(session.NewSession()) uploader :=
> s3manager.NewUploader(sess) _, err =
> uploader.Upload(&s3manager.UploadInput{ Bucket: aws.String(
> "/testbucket/data/set=2012-04-3/"), Key: aws.String("test.json"), Body:
> bytes.NewReader([]byte(message.Body)), }) if err != nil { fmt.Printf("\n
> Error: There was an issue uploading to s3: %s \n", err.Error()) }
>
>
> It may just be me, but having a Bucket equal to "/testbucket/data/set=..."
seems wrong. I would expect something like

{ Bucket: aws:String("testbucket")
  Key: aws.String("/data/set=2012-04-3/test.json"),
  Body: bytes.NewReader([]byte(message.Body)),
}

I'm guessing you get a signature error because in the underlying S3
request, the = messes with the signature of the request. If you read
https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html they
explicitly state that = might require special handling (and while any UTF-8
string is valid, they also suggest a safe character set, not including =).
In S3, it's just a flat string, so if you use something like
/set/2012-04-03/ you are probably going to have an easier time working with
the data, both in Go, and in other languages.


-- 
J.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAGrdgiUkPMTWVUKXQ0HmFTmZNQ9oUqJ3rvduz2Nc1N9He9%3DmDw%40mail.gmail.com.

Reply via email to