Skip to content

Commit 79d6cb1

Browse files
committed
[feature] To optimize upload html File object code.
1 parent 965eb8b commit 79d6cb1

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/file.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -334,9 +334,8 @@ module.exports = function(AV) {
334334
this._source = AV.Promise.as(data.blob, guessedType);
335335
this._isBlob = true;
336336
} else if (typeof(File) !== "undefined" && data instanceof File) {
337-
this._source = readAsync(data, type);
337+
this._source = AV.Promise.as(data, guessedType);
338338
this._isFileObject = true;
339-
this._fileObject = data;
340339
} else if(AV._isNode && global.Buffer.isBuffer(data)) {
341340
// use global.Buffer to prevent browserify pack Buffer module
342341
this._source = AV.Promise.as(data.toString('base64'), guessedType);
@@ -562,7 +561,7 @@ module.exports = function(AV) {
562561
// TODO: remove this code and use qiniu SDK
563562
var dataFormat;
564563
self._previousSave = self._source.then(function(data, type) {
565-
dataFormat = self._fileObject || data;
564+
dataFormat = data;
566565
return self._qiniuToken(type);
567566
}).then(function(response) {
568567
self._url = response.url;

0 commit comments

Comments
 (0)