gcs: Fix compile after removal of SetOpaque
It turns out that the SetOpaque call isn't needed any more as Google aren't returning paths with `%2F` in any more so remove the whole complication. Fixes #676 Fixes #660
This commit is contained in:
parent
d9bba67d18
commit
0c6990bc95
1 changed files with 1 additions and 11 deletions
|
@ -650,20 +650,10 @@ func (o *Object) Storable() bool {
|
||||||
|
|
||||||
// Open an object for read
|
// Open an object for read
|
||||||
func (o *Object) Open() (in io.ReadCloser, err error) {
|
func (o *Object) Open() (in io.ReadCloser, err error) {
|
||||||
// This is slightly complicated by Go here insisting on
|
req, err := http.NewRequest("GET", o.url, nil)
|
||||||
// decoding the %2F in URLs into / which is legal in http, but
|
|
||||||
// unfortunately not what the storage server wants.
|
|
||||||
//
|
|
||||||
// So first encode all the % into their encoded form
|
|
||||||
// URL will decode them giving our original escaped string
|
|
||||||
url := strings.Replace(o.url, "%", "%25", -1)
|
|
||||||
req, err := http.NewRequest("GET", url, nil)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
// SetOpaque sets Opaque such that HTTP requests to it don't
|
|
||||||
// alter any hex-escaped characters
|
|
||||||
googleapi.SetOpaque(req.URL)
|
|
||||||
req.Header.Set("User-Agent", fs.UserAgent)
|
req.Header.Set("User-Agent", fs.UserAgent)
|
||||||
res, err := o.fs.client.Do(req)
|
res, err := o.fs.client.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue