建议formData.append(option.filename, option.file)时,将第三个参数也加上。
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- javascript, react, typescript
- Domain
- frontend
Research direction
Read request.js and locate the FormData append call used for transformed uploads. Reproduce the IE11/blob case described in the issue, then verify that uploaded blobs retain their intended filename without requiring a custom request implementation.
Written by the indexing model from the issue text.
Description
在使用IE11等不支持File constructor的浏览器的情况时,使用transformFile进行图片压缩时,只能返回blob类型数据。

由于request.js中代码 formData.append(option.filename, option.file)并未设置第三个参数filename的值,导致blob文件命名都会变成blob。
可以将代码修改为 formData.append(option.filename, option.file, option.file?.name)
这样只需要在返回blob时自定义blob 的name属性即可达到File类型的效果,而不需要复制一份request来修改代码,并传入customRequest属性来自定义上传表现。
- Dominant language
- TypeScript
- Stars
- 804
- Forks
- 323
- Avg merge
- 12m
- Merged PRs (30d)
- 1
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from react-component/upload
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
react-component/upload#170 ·
-
HVAC website Open
Difficulty 5/5 Over a week Newbie friendliness 10/100
react-component/upload#697 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 15/100
react-component/upload#615 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
react-component/upload#522 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
react-component/upload#515 ·
All issues in react-component/upload
Similar issues
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
dennys-bd/agent-hive#184 ·
-
Add: hunch Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
AbdelStark/awesome-typesafe#104 ·
-
ai-observability bug team/ai-observability
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
vicharanashala/fln#563 ·