combine: throw error if duplicate directory name is specified

See: https://forum.rclone.org/t/v1-59-combine-qs/31814
This commit is contained in:
Nick Craig-Wood 2022-07-10 15:40:30 +01:00
parent f753d7cd42
commit 9c6cfc1ff0

View File

@ -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()