如何使用go和aws-sdk

时间:2018-11-30 16:52:24

标签: go amazon-s3

此代码有效,但会导致文件名下载后名称中带有url编码:

var input = (&s3.PutObjectInput{}).
        SetBucket("io").
        SetKey(filePath)
        resp, _ := svc.PutObjectRequest(input)
        urlStr, err := resp.Presign(15 * time.Minute)

此输入:

var input = (&s3.PutObjectInput{}).
        SetBucket("io").
        SetKey(filePath).
        SetContentDisposition("attachment; filename =\""+fileName+"\"")

URL为PUT后产生此错误消息:There were headers present in the request which were not signed

在签署请求之前尝试尝试here的建议时,

resp, _ := svc.PutObjectRequest(input)
resp.HTTPRequest.Header.Add("ResponseContentDisposition:","attachment; filename =\""+fileName+"\"")

我得到同样的错误。您知道我在做什么错吗,还是有另一种方法来指定带有预签名URL的文件名?

0 个答案:

没有答案