uptobox: fix root path handling - fixes #5903

This commit is contained in:
buengese 2022-06-12 21:35:26 +02:00 committed by Sebastian Bünger
parent cee79f27ee
commit 3a20929db4

View File

@ -163,7 +163,7 @@ func (f *Fs) splitPathFull(pth string) (string, string) {
} }
// splitPath is modified splitPath version that doesn't include the seperator // splitPath is modified splitPath version that doesn't include the seperator
// in the base part // in the base path
func (f *Fs) splitPath(pth string) (string, string) { func (f *Fs) splitPath(pth string) (string, string) {
// chop of any leading or trailing '/' // chop of any leading or trailing '/'
pth = strings.Trim(pth, "/") pth = strings.Trim(pth, "/")
@ -201,7 +201,11 @@ func NewFs(ctx context.Context, name string, root string, config configmap.Mappe
opt: *opt, opt: *opt,
pacer: fs.NewPacer(ctx, pacer.NewDefault(pacer.MinSleep(minSleep), pacer.MaxSleep(maxSleep), pacer.DecayConstant(decayConstant), pacer.AttackConstant(attackConstant))), pacer: fs.NewPacer(ctx, pacer.NewDefault(pacer.MinSleep(minSleep), pacer.MaxSleep(maxSleep), pacer.DecayConstant(decayConstant), pacer.AttackConstant(attackConstant))),
} }
f.root = root if root == "/" || root == "." {
f.root = ""
} else {
f.root = root
}
f.features = (&fs.Features{ f.features = (&fs.Features{
DuplicateFiles: true, DuplicateFiles: true,
CanHaveEmptyDirectories: true, CanHaveEmptyDirectories: true,