From 9c6cfc1ff0412b75592067e9017bf36a0e555078 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Sun, 10 Jul 2022 15:40:30 +0100 Subject: [PATCH] combine: throw error if duplicate directory name is specified See: https://forum.rclone.org/t/v1-59-combine-qs/31814 --- backend/combine/combine.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/backend/combine/combine.go b/backend/combine/combine.go index 36fdc69c6..a65192647 100644 --- a/backend/combine/combine.go +++ b/backend/combine/combine.go @@ -206,9 +206,13 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (outFs fs return err } mu.Lock() - f.upstreams[dir] = u + if _, found := f.upstreams[dir]; found { + err = fmt.Errorf("duplicate directory name %q", dir) + } else { + f.upstreams[dir] = u + } mu.Unlock() - return nil + return err }) } err = g.Wait()