Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: WriteMultipartFormFile will fail when the Reader return EOF at first Read #748

Merged
merged 1 commit into from
Apr 27, 2023

Conversation

wzekin
Copy link
Contributor

@wzekin wzekin commented Apr 24, 2023

What type of PR is this?

fix

Check the PR title.

  • This PR title match the format: <type>(optional scope): <description>.
  • The description of this PR title is user-oriented and clear enough for others to understand.
  • Attach the PR updating the user documentation if the current PR requires user awareness at the usage level. User docs repo.

(Optional) Translate the PR title into Chinese.

修复:当传入的 Reader 的第一次 Read 返回 EOF 时,WriteMultipartFormFile将会失败

(Optional) More detail description for this PR(en: English/zh: Chinese).

en: WriteMultipartFormFile does not check whether the return of Read is EOF. When Read returns EOF, WriteMultipartForm will return an error. Replace Read with io.LimitedReader to fix this
zh(optional): WriteMultipartFormFile 没有检查 Read 的返回是否是 EOF,当 Read 返回了 EOF 时, WriteMultipartForm 将会返回错误。将 Read 替换为 io.LimitedReader 来修复此问题

(Optional) Which issue(s) this PR fixes:

Fixes #746

(Optional) The PR that updates user documentation:

@wzekin wzekin requested review from a team as code owners April 24, 2023 08:08
@codecov
Copy link

codecov bot commented Apr 24, 2023

Codecov Report

Patch coverage: 50.00% and project coverage change: +0.02 🎉

Comparison is base (2800a9b) 75.68% compared to head (2c9f740) 75.70%.

❗ Current head 2c9f740 differs from pull request most recent head aefefc5. Consider uploading reports for the commit aefefc5 to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #748      +/-   ##
===========================================
+ Coverage    75.68%   75.70%   +0.02%     
===========================================
  Files           97       97              
  Lines         9464     9464              
===========================================
+ Hits          7163     7165       +2     
+ Misses        1853     1850       -3     
- Partials       448      449       +1     
Impacted Files Coverage Δ
pkg/protocol/multipart.go 77.21% <50.00%> (-2.54%) ⬇️

... and 1 file with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@wzekin wzekin force-pushed the fix/upload_files branch from b39c3bb to d7cec68 Compare April 26, 2023 09:04
@wzekin wzekin force-pushed the fix/upload_files branch from d7cec68 to aefefc5 Compare April 26, 2023 09:10
Copy link
Member

@welkeyever welkeyever left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@welkeyever welkeyever merged commit a8a426e into cloudwego:develop Apr 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

upload files EOF err when file size less than 512 bytes
5 participants