update github.com/ncw/swift package in vendor to v1.0.40
Signed-off-by: Corey Quon <corey.quon@gmail.com>
This commit is contained in:
parent
5a74b806f0
commit
fd32d5f962
4 changed files with 46 additions and 28 deletions
22
vendor/github.com/ncw/swift/swift.go
generated
vendored
22
vendor/github.com/ncw/swift/swift.go
generated
vendored
|
@ -297,6 +297,7 @@ var (
|
|||
TimeoutError = newError(408, "Timeout when reading or writing data")
|
||||
Forbidden = newError(403, "Operation forbidden")
|
||||
TooLargeObject = newError(413, "Too Large Object")
|
||||
RateLimit = newError(498, "Rate Limit")
|
||||
|
||||
// Mappings for authentication errors
|
||||
authErrorMap = errorMap{
|
||||
|
@ -311,6 +312,7 @@ var (
|
|||
403: Forbidden,
|
||||
404: ContainerNotFound,
|
||||
409: ContainerNotEmpty,
|
||||
498: RateLimit,
|
||||
}
|
||||
|
||||
// Mappings for object errors
|
||||
|
@ -321,6 +323,7 @@ var (
|
|||
404: ObjectNotFound,
|
||||
413: TooLargeObject,
|
||||
422: ObjectCorrupted,
|
||||
498: RateLimit,
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -1840,14 +1843,16 @@ type BulkDeleteResult struct {
|
|||
func (c *Connection) doBulkDelete(objects []string) (result BulkDeleteResult, err error) {
|
||||
var buffer bytes.Buffer
|
||||
for _, s := range objects {
|
||||
buffer.WriteString(url.QueryEscape(s) + "\n")
|
||||
u := url.URL{Path: s}
|
||||
buffer.WriteString(u.String() + "\n")
|
||||
}
|
||||
resp, headers, err := c.storage(RequestOpts{
|
||||
Operation: "DELETE",
|
||||
Parameters: url.Values{"bulk-delete": []string{"1"}},
|
||||
Headers: Headers{
|
||||
"Accept": "application/json",
|
||||
"Content-Type": "text/plain",
|
||||
"Accept": "application/json",
|
||||
"Content-Type": "text/plain",
|
||||
"Content-Length": strconv.Itoa(buffer.Len()),
|
||||
},
|
||||
ErrorMap: ContainerErrorMap,
|
||||
Body: &buffer,
|
||||
|
@ -2074,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
|
||||
|
@ -2086,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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue