Skip to content

Commit

Permalink
修复 http 页面微信 webview 分片上传出错
Browse files Browse the repository at this point in the history
  • Loading branch information
carsonxu committed Jan 7, 2019
1 parent 53408a7 commit e2b1058
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
11 changes: 9 additions & 2 deletions dist/cos-js-sdk-v5.js
Original file line number Diff line number Diff line change
Expand Up @@ -1979,7 +1979,7 @@ base.init(COS, task);
advance.init(COS, task);

COS.getAuthorization = util.getAuth;
COS.version = '0.5.5';
COS.version = '0.5.6';

module.exports = COS;

Expand Down Expand Up @@ -5363,14 +5363,21 @@ function restoreObject(params, callback) {
* @return {Object} data 返回的数据
*/
function multipartInit(params, callback) {

var xml = util.json2xml({});
var headers = params.Headers;
headers['Content-Type'] = 'application/xml';
headers['Content-MD5'] = util.binaryBase64(util.md5(xml));

submitRequest.call(this, {
Action: 'name/cos:InitiateMultipartUpload',
method: 'POST',
Bucket: params.Bucket,
Region: params.Region,
Key: params.Key,
action: 'uploads',
headers: params.Headers
headers: params.Headers,
body: xml
}, function (err, data) {
if (err) {
return callback(err);
Expand Down
2 changes: 1 addition & 1 deletion dist/cos-js-sdk-v5.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cos-js-sdk-v5",
"version": "0.5.5",
"version": "0.5.6",
"description": "JavaScript SDK for [腾讯云对象存储](https://cloud.tencent.com/product/cos)",
"main": "index.js",
"scripts": {
Expand Down
7 changes: 7 additions & 0 deletions src/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -1449,6 +1449,12 @@ function restoreObject(params, callback) {
* @return {Object} data 返回的数据
*/
function multipartInit(params, callback) {

var xml = util.json2xml({});
var headers = params.Headers;
headers['Content-Type'] = 'application/xml';
headers['Content-MD5'] = util.binaryBase64(util.md5(xml));

submitRequest.call(this, {
Action: 'name/cos:InitiateMultipartUpload',
method: 'POST',
Expand All @@ -1457,6 +1463,7 @@ function multipartInit(params, callback) {
Key: params.Key,
action: 'uploads',
headers: params.Headers,
body: xml,
}, function (err, data) {
if (err) {
return callback(err);
Expand Down

0 comments on commit e2b1058

Please sign in to comment.