Skip to content

Commit

Permalink
Use base filename on test (golang/go#45789)
Browse files Browse the repository at this point in the history
On older versions of Go, `multipart.Part.FileName()` includes the
directory path information, which doesn't comply with RFC 7578.

In order to accomodate the tests for older Go versions, the base name is
obtained regardless.
  • Loading branch information
anpep committed Sep 2, 2022
1 parent 56c65b1 commit 611d6a8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion client/files_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"bytes"
"encoding/json"
"io"
"path"
"strings"

. "gopkg.in/check.v1"
Expand Down Expand Up @@ -79,7 +80,7 @@ func (cs *clientSuite) TestPush(c *C) {
c.Assert(err, IsNil)
c.Assert(file.Header.Get("Content-Type"), Equals, "application/octet-stream")
c.Assert(file.FormName(), Equals, "files")
c.Assert(file.FileName(), Equals, "file.dat")
c.Assert(path.Base(file.FileName()), Equals, "file.dat")

buf.Reset()
_, err = buf.ReadFrom(file)
Expand Down

0 comments on commit 611d6a8

Please sign in to comment.