Skip to content

Commit

Permalink
putObject sliceUploadFile 统一返回值格式。
Browse files Browse the repository at this point in the history
  • Loading branch information
carsonxu committed Dec 17, 2020
1 parent 056bbb5 commit f95505c
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 37 deletions.
35 changes: 17 additions & 18 deletions dist/cos-js-sdk-v5.js
Original file line number Diff line number Diff line change
Expand Up @@ -7361,8 +7361,23 @@ function multipartComplete(params, callback) {
object: params.Key,
isLocation: true
});
var CompleteMultipartUploadResult = data.CompleteMultipartUploadResult || {};
var result = util.extend(CompleteMultipartUploadResult, {
var res = data.CompleteMultipartUploadResult || {};
if (res.ProcessResults) {
if (res && res.ProcessResults) {
res.UploadResult = {
OriginalInfo: {
Key: res.Key,
Location: res.Location,
ETag: res.ETag,
ImageInfo: res.ImageInfo
},
ProcessResults: res.ProcessResults
};
delete res.ImageInfo;
delete res.ProcessResults;
}
}
var result = util.extend(res, {
Location: url,
statusCode: data.statusCode,
headers: data.headers
Expand Down Expand Up @@ -8979,22 +8994,6 @@ function uploadSliceComplete(params, callback) {
Headers: Headers
}, tryCallback);
}, function (err, data) {
if (data && data.ProcessResults) {
data.UploadResult = {
OriginalInfo: {
Key: data.Key,
Location: data.Location,
ETag: data.ETag,
ImageInfo: data.ImageInfo
},
ProcessResults: data.ProcessResults
};
delete data.Key;
delete data.Location;
delete data.ETag;
delete data.ImageInfo;
delete data.ProcessResults;
}
callback(err, data);
});
}
Expand Down
2 changes: 1 addition & 1 deletion dist/cos-js-sdk-v5.min.js

Large diffs are not rendered by default.

16 changes: 0 additions & 16 deletions src/advance.js
Original file line number Diff line number Diff line change
Expand Up @@ -651,22 +651,6 @@ function uploadSliceComplete(params, callback) {
Headers: Headers,
}, tryCallback);
}, function (err, data) {
if (data && data.ProcessResults) {
data.UploadResult = {
OriginalInfo: {
Key: data.Key,
Location: data.Location,
ETag: data.ETag,
ImageInfo: data.ImageInfo,
},
ProcessResults: data.ProcessResults,
};
delete data.Key;
delete data.Location;
delete data.ETag;
delete data.ImageInfo;
delete data.ProcessResults;
}
callback(err, data);
});
}
Expand Down
19 changes: 17 additions & 2 deletions src/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -2612,8 +2612,23 @@ function multipartComplete(params, callback) {
object: params.Key,
isLocation: true,
});
var CompleteMultipartUploadResult = data.CompleteMultipartUploadResult || {};
var result = util.extend(CompleteMultipartUploadResult, {
var res = data.CompleteMultipartUploadResult || {};
if (res.ProcessResults) {
if (res && res.ProcessResults) {
res.UploadResult = {
OriginalInfo: {
Key: res.Key,
Location: res.Location,
ETag: res.ETag,
ImageInfo: res.ImageInfo,
},
ProcessResults: res.ProcessResults,
};
delete res.ImageInfo;
delete res.ProcessResults;
}
}
var result = util.extend(res, {
Location: url,
statusCode: data.statusCode,
headers: data.headers,
Expand Down

0 comments on commit f95505c

Please sign in to comment.