vendor: update github.com/ncw/swift to fix server side copy bug

This commit is contained in:
Nick Craig-Wood 2018-08-26 15:03:19 +01:00
parent 3751ceebdd
commit a64e0922b9
6 changed files with 63 additions and 36 deletions

6
Gopkg.lock generated
View File

@ -250,12 +250,12 @@
revision = "887eb06ab6a255fbf5744b5812788e884078620a" revision = "887eb06ab6a255fbf5744b5812788e884078620a"
[[projects]] [[projects]]
digest = "1:7a4827b2062a21ba644241bdec27959a5be2670f8aa4038ba14cfe2ce389e8d2" digest = "1:e5b9ef2c82d0c904496a3fd6b14e34081df4d425d42d8e57d182ac3d8c93e98a"
name = "github.com/ncw/swift" name = "github.com/ncw/swift"
packages = ["."] packages = ["."]
pruneopts = "" pruneopts = ""
revision = "b2a7479cf26fa841ff90dd932d0221cb5c50782d" revision = "a0320860b16212c2b59b4912bb6508cda1d7cee6"
version = "v1.0.39" version = "v1.0.40"
[[projects]] [[projects]]
branch = "master" branch = "master"

View File

@ -2,26 +2,29 @@ language: go
sudo: false sudo: false
go: go:
- 1.1.2 - 1.1.x
- 1.2.2 - 1.2.x
- 1.3.3 - 1.3.x
- 1.4.3 - 1.4.x
- 1.5.4 - 1.5.x
- 1.6.4 - 1.6.x
- 1.7.5 - 1.7.x
- 1.8 - 1.8.x
- 1.9.x
- 1.10.x
- 1.11.x
- master - master
matrix: matrix:
include: include:
- go: 1.8 - go: 1.11.x
env: TEST_REAL_SERVER=rackspace env: TEST_REAL_SERVER=rackspace
- go: 1.8 - go: 1.11.x
env: TEST_REAL_SERVER=memset env: TEST_REAL_SERVER=memset
allow_failures: allow_failures:
- go: 1.8 - go: 1.11.x
env: TEST_REAL_SERVER=rackspace env: TEST_REAL_SERVER=rackspace
- go: 1.8 - go: 1.11.x
env: TEST_REAL_SERVER=memset env: TEST_REAL_SERVER=memset
install: go test -i ./... install: go test -i ./...
script: script:

View File

@ -26,7 +26,7 @@ See here for full package docs
- http://godoc.org/github.com/ncw/swift - http://godoc.org/github.com/ncw/swift
Here is a short example from the docs Here is a short example from the docs
```go
import "github.com/ncw/swift" import "github.com/ncw/swift"
// Create a connection // Create a connection
@ -46,6 +46,7 @@ Here is a short example from the docs
containers, err := c.ContainerNames(nil) containers, err := c.ContainerNames(nil)
fmt.Println(containers) fmt.Println(containers)
// etc... // etc...
```
Additions Additions
--------- ---------

11
vendor/github.com/ncw/swift/swift.go generated vendored
View File

@ -2079,6 +2079,15 @@ func (c *Connection) ObjectUpdate(container string, objectName string, h Headers
return err return err
} }
// urlPathEscape escapes URL path the in string using URL escaping rules
//
// This mimics url.PathEscape which only available from go 1.8
func urlPathEscape(in string) string {
var u url.URL
u.Path = in
return u.String()
}
// ObjectCopy does a server side copy of an object to a new position // ObjectCopy does a server side copy of an object to a new position
// //
// All metadata is preserved. If metadata is set in the headers then // All metadata is preserved. If metadata is set in the headers then
@ -2091,7 +2100,7 @@ func (c *Connection) ObjectUpdate(container string, objectName string, h Headers
func (c *Connection) ObjectCopy(srcContainer string, srcObjectName string, dstContainer string, dstObjectName string, h Headers) (headers Headers, err error) { func (c *Connection) ObjectCopy(srcContainer string, srcObjectName string, dstContainer string, dstObjectName string, h Headers) (headers Headers, err error) {
// Meta stuff // Meta stuff
extraHeaders := map[string]string{ extraHeaders := map[string]string{
"Destination": dstContainer + "/" + dstObjectName, "Destination": urlPathEscape(dstContainer + "/" + dstObjectName),
} }
for key, value := range h { for key, value := range h {
extraHeaders[key] = value extraHeaders[key] = value

View File

@ -1479,6 +1479,20 @@ func TestObjectCopy(t *testing.T) {
} }
} }
func TestObjectCopyDifficultName(t *testing.T) {
c, rollback := makeConnectionWithObjectHeaders(t)
defer rollback()
const dest = OBJECT + "?param %30%31%32 £100"
_, err := c.ObjectCopy(CONTAINER, OBJECT, CONTAINER, dest, nil)
if err != nil {
t.Fatal(err)
}
err = c.ObjectDelete(CONTAINER, dest)
if err != nil {
t.Fatal(err)
}
}
func TestObjectCopyWithMetadata(t *testing.T) { func TestObjectCopyWithMetadata(t *testing.T) {
c, rollback := makeConnectionWithObjectHeaders(t) c, rollback := makeConnectionWithObjectHeaders(t)
defer rollback() defer rollback()

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
set -e set -e
if [ ! "${TRAVIS_BRANCH}" = "master" ]; then if [ "${TRAVIS_PULL_REQUEST}" = "true" ]; then
exit 0 exit 0
fi fi