mirror of
https://github.com/rclone/rclone.git
synced 2024-11-23 02:56:25 +08:00
google cloud storage: Make operations on single files work
This commit is contained in:
parent
a1732c21d8
commit
b72fc69fbe
|
@ -15,6 +15,7 @@ import (
|
|||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"path"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
|
@ -139,20 +140,19 @@ func NewFs(name, root string) (fs.Fs, error) {
|
|||
if f.root != "" {
|
||||
f.root += "/"
|
||||
// Check to see if the object exists
|
||||
// FIXME
|
||||
// _, _, err = f.svc.Object(bucket, directory)
|
||||
// if err == nil {
|
||||
// remote := path.Base(directory)
|
||||
// f.root = path.Dir(directory)
|
||||
// if f.root == "." {
|
||||
// f.root = ""
|
||||
// } else {
|
||||
// f.root += "/"
|
||||
// }
|
||||
// obj := f.NewFsObject(remote)
|
||||
// // return a Fs Limited to this object
|
||||
// return fs.NewLimited(f, obj), nil
|
||||
// }
|
||||
_, err = f.svc.Objects.Get(bucket, directory).Do()
|
||||
if err == nil {
|
||||
remote := path.Base(directory)
|
||||
f.root = path.Dir(directory)
|
||||
if f.root == "." {
|
||||
f.root = ""
|
||||
} else {
|
||||
f.root += "/"
|
||||
}
|
||||
obj := f.NewFsObject(remote)
|
||||
// return a Fs Limited to this object
|
||||
return fs.NewLimited(f, obj), nil
|
||||
}
|
||||
}
|
||||
return f, nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user