Skip to content

Commit b625bf5

Browse files
committed
Merge pull request #89 from killme2008/develop
Develop
2 parents f4288f7 + d675240 commit b625bf5

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

qiniu/io.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ function PutExtra(params, mimeType, crc32, checkCrc) {
2727
function PutRet(hash, key) {
2828
this.hash = hash || null;
2929
this.key = key || null;
30-
}
30+
}
3131

32-
// onret: callback function instead of ret
32+
// onret: callback function instead of ret
3333
function put(uptoken, key, body, extra, onret) {
3434
if(!extra) {
3535
extra = new PutExtra();
@@ -59,8 +59,8 @@ function getMultipart(uptoken, key, body, extra) {
5959
if(key != exports.UNDEFINED_KEY) {
6060
form.field('key', key);
6161
}
62-
63-
form.buffer('file', new Buffer(body), key, extra.mimeType);
62+
var buf = Buffer.isBuffer(body) ? body : new Buffer(body);
63+
form.buffer('file', buf, key, extra.mimeType);
6464

6565
//extra['checkcrc']
6666
if (extra.checkCrc == 1) {
@@ -100,4 +100,3 @@ function putFile(uptoken, key, loadFile, extra, onret) {
100100
function putFileWithoutKey(uptoken, loadFile, extra, onret) {
101101
putFile(uptoken, null, loadFile, extra, onret);
102102
}
103-

0 commit comments

Comments
 (0)