AWS S3 signed url encode resulting “SignatureDoesN

2019-04-09 11:29发布

I am using cordova file transfer to dowload a file from aws s3 using signed url, since cordova filetransfer encodes the uri, the "%" in signature is converted to "%25", thus, results in signature mismatch

1条回答
别忘想泡老子
2楼-- · 2019-04-09 12:02

Try setting up your options like so:

options = {
            fileKey: 'file',
            fileName: name,
            chunkedMode: false,
            mimeType: 'audio/3gpp',
            httpMethod: 'PUT',
            // Important!
            headers: {
                'Content-Type': 'audio/3gpp' // < Set explicitly otherwise it becomes multipart/form-data which won't work with S3
            },
            encodeURI: false // < Stops any extra encoding by file transfer logic
        }

Took me many painful hours getting pre signed PUTs working with cordova / S3. Goodluck.

查看更多
登录 后发表回答