cfug / dio

A powerful HTTP client for Dart and Flutter, which supports global settings, Interceptors, FormData, aborting and canceling a request, files uploading and downloading, requests timeout, custom adapters, etc.
https://dio.pub
MIT License
12.44k stars 1.51k forks source link

上传aliOss报错,原因是header中Content-Disposition和Content-Type位置颠倒 #534

Closed zhang00829 closed 4 years ago

zhang00829 commented 4 years ago

首先感谢作者大大,开源这么好用的工具!

最近将公司原项目dio版本升级到3.0.4,发现原先正常上传图片到aliOss的功能不能用了,aliOss返回错误:The body of your POST request is not well-formed multipart/form-data。

经过比对2.x.x和3.x.x,发现如下不同点:

dio2.x.x上传文件header: 191572402229_ pic

dio 3.x.x上传文件header:

WechatIMG20

dio 2.x.x 源码:

2 x

dio 3.x.x源码:

3 x

解决办法: 手动更改源码,将二者调换位置,成功上传到AliOss。 image

希望作者能早日修复此bug,在issue中也有人提出类似问题,例如:例如#505。

fvisticot commented 4 years ago

I have the same issue and I can not upload picture with this current version. Can you please fix this issue ?

wendux commented 4 years ago

@zhanglei829 @fvisticot fixed it at v3.0.5, please update and try again.

zhang00829 commented 4 years ago

完美解决,👍