1
0
mirror of https://github.com/golang/go synced 2024-09-29 12:24:31 -06:00

mime/multipart: use %w when wrapping error in NextPart

Use "%w" instead of "%v" as format verb for error value in the NextPart
method. This way it will be possible to use common go error utilities
from std library when parsing from custom io.Readers.

This issue was discovered during attempts to use
http.Request.ParseMultipartForm together with http.MaxBytesHandler.

Change-Id: Idb82510fb536b66b51ed1d943737c4828f07c2f2
GitHub-Last-Rev: 8bc49c945c
GitHub-Pull-Request: golang/go#55133
Reviewed-on: https://go-review.googlesource.com/c/go/+/431675
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
This commit is contained in:
thinkofher 2022-09-19 21:35:04 +00:00 committed by Gopher Robot
parent 4c414c7673
commit 1e7e160d07

View File

@ -360,7 +360,7 @@ func (r *Reader) nextPart(rawPart bool) (*Part, error) {
return nil, io.EOF
}
if err != nil {
return nil, fmt.Errorf("multipart: NextPart: %v", err)
return nil, fmt.Errorf("multipart: NextPart: %w", err)
}
if r.isBoundaryDelimiterLine(line) {