From b62bd2eea0e52b64257c2d1b60f0c8b02243fc2c Mon Sep 17 00:00:00 2001 From: Jingdan Date: Wed, 24 Jan 2018 15:36:24 +0800 Subject: [PATCH] fix: multipartUpload small file upload by callback data (#358) * fix(multipartUpload): https://github.com/ali-sdk/ali-oss/issues/319 issues * fix: check data --- lib/browser/multipart.js | 4 +++- lib/multipart.js | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/browser/multipart.js b/lib/browser/multipart.js index 34a8d1e0b..b085270c2 100644 --- a/lib/browser/multipart.js +++ b/lib/browser/multipart.js @@ -50,9 +50,11 @@ proto.multipartUpload = function* multipartUpload(name, file, options) { name: name, etag: result.res.headers.etag }; + if (options.headers && options.headers['x-oss-callback']) { - ret.data = JSON.parse(result.data.toString()); + ret.data = result.data; } + return ret; } diff --git a/lib/multipart.js b/lib/multipart.js index 91af58681..dc19b7205 100644 --- a/lib/multipart.js +++ b/lib/multipart.js @@ -50,9 +50,11 @@ proto.multipartUpload = function* multipartUpload(name, file, options) { name: name, etag: result.res.headers.etag }; + if (options.headers && options.headers['x-oss-callback']) { - ret.data = JSON.parse(result.data.toString()); + ret.data = result.data; } + return ret; }