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"
[[projects]]
digest = "1:7a4827b2062a21ba644241bdec27959a5be2670f8aa4038ba14cfe2ce389e8d2"
digest = "1:e5b9ef2c82d0c904496a3fd6b14e34081df4d425d42d8e57d182ac3d8c93e98a"
name = "github.com/ncw/swift"
packages = ["."]
pruneopts = ""
revision = "b2a7479cf26fa841ff90dd932d0221cb5c50782d"
version = "v1.0.39"
revision = "a0320860b16212c2b59b4912bb6508cda1d7cee6"
version = "v1.0.40"
[[projects]]
branch = "master"

View File

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

View File

@ -26,26 +26,27 @@ See here for full package docs
- http://godoc.org/github.com/ncw/swift
Here is a short example from the docs
```go
import "github.com/ncw/swift"
import "github.com/ncw/swift"
// Create a connection
c := swift.Connection{
UserName: "user",
ApiKey: "key",
AuthUrl: "auth_url",
Domain: "domain", // Name of the domain (v3 auth only)
Tenant: "tenant", // Name of the tenant (v2 auth only)
}
// Authenticate
err := c.Authenticate()
if err != nil {
panic(err)
}
// List all the containers
containers, err := c.ContainerNames(nil)
fmt.Println(containers)
// etc...
// Create a connection
c := swift.Connection{
UserName: "user",
ApiKey: "key",
AuthUrl: "auth_url",
Domain: "domain", // Name of the domain (v3 auth only)
Tenant: "tenant", // Name of the tenant (v2 auth only)
}
// Authenticate
err := c.Authenticate()
if err != nil {
panic(err)
}
// List all the containers
containers, err := c.ContainerNames(nil)
fmt.Println(containers)
// etc...
```
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
}
// 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
//
// 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) {
// Meta stuff
extraHeaders := map[string]string{
"Destination": dstContainer + "/" + dstObjectName,
"Destination": urlPathEscape(dstContainer + "/" + dstObjectName),
}
for key, value := range h {
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) {
c, rollback := makeConnectionWithObjectHeaders(t)
defer rollback()

View File

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