]> Cypherpunks.ru repositories - gostls13.git/commitdiff
mime/multipart: use %w when wrapping error in NextPart
authorthinkofher <mail@bdudek.xyz>
Mon, 19 Sep 2022 21:35:04 +0000 (21:35 +0000)
committerGopher Robot <gobot@golang.org>
Tue, 20 Sep 2022 02:11:38 +0000 (02:11 +0000)
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: 8bc49c945c1b393bcfb4d8df545c93593c9bd7c4
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>
src/mime/multipart/multipart.go

index aa05ac8f9c8a5f1f6e28a09a34f36ddd81653f8c..b3a904f0aff340149a9cf7f5a871d855dd9c44d6 100644 (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) {