fix(multipart): fix error when parsing file name in utf8 format #5428
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fix error "content-disposition must be set" when parsing file name in utf8 format
What happens
when i upload a file name in utf8 format, it throw an error "content-disposition must be set"
How To Reproduce
front
deno code
Where is the problem
in my code
=>
deno/std/mime/multipart.ts
Line 284 in 750a341
=>
deno/std/mime/multipart.ts
Line 290 in 750a341
=>
deno/std/mime/multipart.ts
Line 371 in 750a341
=>
deno/std/textproto/mod.ts
Line 51 in 750a341
in readMIMEHeader
deno/std/textproto/mod.ts
Line 52 in 750a341
deno/std/textproto/mod.ts
Line 110 in 750a341
No problem when the encoding of the value is ASCII.
But it is ignored when the value is in utf8 format( When the file name of the uploaded file is in utf8 format,the value is "form-data; name="filefield"; filename="微信图片_20200211090118.png")
in getContentDispositionParams
deno/std/mime/multipart.ts
Line 206 in 750a341
cd is null,
so i get error "content-disposition must be set" When executed to
deno/std/mime/multipart.ts
Line 208 in 750a341