Commit 032f439
authored
feat: support custom filename when file is Buffer or Readable (#508)
> Uploading files with Buffer defaults the filename to the key or path,
which can conflict with middleware checks.
* 🤖 files as an object defaults filename to the key.
~~* 🚨 File paths or streams also override the filename.~~
* ♻️ only work for buffer scence.
----------
> 当直接通过 Buffer 来上传文件时,无法自定义文件名,这在某些中间件会校验 filename,导致无法上传。
* 🤖 files 参数为 object 时,默认将 key 作为文件名传输
~~* 🚨 传入文件路径或 Readable 流时也同样覆盖~~
* ♻️ 仅处理 buffer 场景
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
## Summary by CodeRabbit
- **New Features**
- Enhanced file upload functionality to support optional custom file
names, allowing users to specify filenames when uploading files.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->1 parent bc21ec3 commit 032f439
2 files changed
+37
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
440 | 440 | | |
441 | 441 | | |
442 | 442 | | |
443 | | - | |
| 443 | + | |
444 | 444 | | |
445 | 445 | | |
446 | 446 | | |
| |||
452 | 452 | | |
453 | 453 | | |
454 | 454 | | |
455 | | - | |
| 455 | + | |
| 456 | + | |
456 | 457 | | |
457 | 458 | | |
458 | 459 | | |
| |||
461 | 462 | | |
462 | 463 | | |
463 | 464 | | |
464 | | - | |
| 465 | + | |
465 | 466 | | |
466 | 467 | | |
467 | 468 | | |
| |||
470 | 471 | | |
471 | 472 | | |
472 | 473 | | |
473 | | - | |
| 474 | + | |
474 | 475 | | |
475 | | - | |
| 476 | + | |
476 | 477 | | |
477 | 478 | | |
478 | 479 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
123 | | - | |
| 123 | + | |
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| |||
268 | 268 | | |
269 | 269 | | |
270 | 270 | | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
271 | 301 | | |
0 commit comments