mirror of https://github.com/perkeep/perkeep.git
third_party/google.golang.org/api/storage: update to fix upload breakage
@ rev 3f7dcd0e7a9cbcc8199def5ec2b0be34261ff67c Change-Id: Ibbcd8913815eb67c15bb2739180322d41e601475
This commit is contained in:
parent
be6f44434a
commit
f23c4b5b02
|
@ -11,11 +11,11 @@ package storage
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"camlistore.org/third_party/golang.org/x/net/context"
|
||||
"camlistore.org/third_party/google.golang.org/api/googleapi"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"camlistore.org/third_party/golang.org/x/net/context"
|
||||
"camlistore.org/third_party/google.golang.org/api/googleapi"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
@ -4508,6 +4508,11 @@ func (c *ObjectsInsertCall) Do() (*Object, error) {
|
|||
params.Set("uploadType", c.protocol_)
|
||||
}
|
||||
urls += "?" + params.Encode()
|
||||
var contentLength_ int64
|
||||
var hasMedia_ bool
|
||||
if c.protocol_ != "resumable" {
|
||||
contentLength_, hasMedia_ = googleapi.ConditionallyIncludeMedia(c.media_, &body, &ctype)
|
||||
}
|
||||
req, _ := http.NewRequest("POST", urls, body)
|
||||
googleapi.Expand(req.URL, map[string]string{
|
||||
"bucket": c.bucket,
|
||||
|
@ -4522,12 +4527,9 @@ func (c *ObjectsInsertCall) Do() (*Object, error) {
|
|||
if params.Get("name") == "" {
|
||||
return nil, fmt.Errorf("resumable uploads must set the Name parameter.")
|
||||
}
|
||||
} else {
|
||||
contentLength_, hasMedia_ := googleapi.ConditionallyIncludeMedia(c.media_, &body, &ctype)
|
||||
if hasMedia_ {
|
||||
req.ContentLength = contentLength_
|
||||
req.Header.Set("Content-Type", ctype)
|
||||
}
|
||||
} else if hasMedia_ {
|
||||
req.ContentLength = contentLength_
|
||||
req.Header.Set("Content-Type", ctype)
|
||||
}
|
||||
req.Header.Set("User-Agent", "google-api-go-client/0.5")
|
||||
res, err := c.s.client.Do(req)
|
||||
|
|
Loading…
Reference in New Issue