fix rclone ns
parent
898f7e886a
commit
428218f45f
21
rclone.go
21
rclone.go
|
|
@ -35,8 +35,11 @@ func NewRClone(rclone string, ns ...string) (*RClone, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (rc *RClone) Get(key string, ns ...string) ([]byte, error) {
|
func (rc *RClone) Get(key string, ns ...string) ([]byte, error) {
|
||||||
namespace := resolveNamespace(ns)
|
namespace := rc.ns
|
||||||
namespace = path.Join(rc.ns, namespace)
|
if len(ns) > 0 {
|
||||||
|
namespace = path.Join(rc.ns, resolveNamespace(ns))
|
||||||
|
}
|
||||||
|
|
||||||
key = path.Join(namespace, key)
|
key = path.Join(namespace, key)
|
||||||
f, err := fs.NewFs(path.Dir(key))
|
f, err := fs.NewFs(path.Dir(key))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -57,8 +60,11 @@ func (rc *RClone) Set(key string, value []byte, ns ...string) error {
|
||||||
if len(value) == 0 {
|
if len(value) == 0 {
|
||||||
return rc.Del(key, ns...)
|
return rc.Del(key, ns...)
|
||||||
}
|
}
|
||||||
namespace := resolveNamespace(ns)
|
namespace := rc.ns
|
||||||
namespace = path.Join(rc.ns, namespace)
|
if len(ns) > 0 {
|
||||||
|
namespace = path.Join(rc.ns, resolveNamespace(ns))
|
||||||
|
}
|
||||||
|
|
||||||
key = path.Join(namespace, key)
|
key = path.Join(namespace, key)
|
||||||
f, err := fs.NewFs(path.Dir(key))
|
f, err := fs.NewFs(path.Dir(key))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -70,8 +76,11 @@ func (rc *RClone) Set(key string, value []byte, ns ...string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (rc *RClone) Del(key string, ns ...string) error {
|
func (rc *RClone) Del(key string, ns ...string) error {
|
||||||
namespace := resolveNamespace(ns)
|
namespace := rc.ns
|
||||||
namespace = path.Join(rc.ns, namespace)
|
if len(ns) > 0 {
|
||||||
|
namespace = path.Join(rc.ns, resolveNamespace(ns))
|
||||||
|
}
|
||||||
|
|
||||||
key = path.Join(namespace, key)
|
key = path.Join(namespace, key)
|
||||||
f, err := fs.NewFs(path.Dir(key))
|
f, err := fs.NewFs(path.Dir(key))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue