Skip to content

Commit cd1e88a

Browse files
committed
fix Blob throws error in jsdom
1 parent e52afb6 commit cd1e88a

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rc-upload",
3-
"version": "3.0.3",
3+
"version": "3.0.4",
44
"description": "upload ui component for react",
55
"keywords": [
66
"react",
@@ -33,7 +33,7 @@
3333
"compile": "rc-tools run compile --babel-runtime",
3434
"pub": "rc-tools run pub --babel-runtime",
3535
"lint": "rc-tools run lint",
36-
"test": "jest --setupTestFrameworkScriptFile=raf/polyfill",
36+
"test": "jest --setupTestFrameworkScriptFile=raf/polyfill",
3737
"coverage": "jest --coverage && cat ./coverage/lcov.info | coveralls"
3838
},
3939
"devDependencies": {

src/request.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,11 @@ export default function upload(option) {
6262
});
6363
}
6464

65-
formData.append(option.filename, option.file, option.file instanceof Blob && option.file.name);
65+
if (option.file instanceof Blob) {
66+
formData.append(option.filename, option.file, option.file.name);
67+
} else {
68+
formData.append(option.filename, option.file);
69+
}
6670

6771
xhr.onerror = function error(e) {
6872
option.onError(e);

0 commit comments

Comments
 (0)