From 7db1c506f261698a536c343de39b628fc82e13bb Mon Sep 17 00:00:00 2001 From: albertony <12441419+albertony@users.noreply.github.com> Date: Sat, 19 Nov 2022 00:53:21 +0100 Subject: [PATCH] smb: fix issue where spurious dot directory is created --- backend/smb/smb.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/smb/smb.go b/backend/smb/smb.go index 3e750cc1f..688221ce4 100644 --- a/backend/smb/smb.go +++ b/backend/smb/smb.go @@ -478,11 +478,15 @@ func (f *Fs) makeEntryRelative(share, _path, relative string, stat os.FileInfo) } func (f *Fs) ensureDirectory(ctx context.Context, share, _path string) error { + dir := path.Dir(_path) + if dir == "." { + return nil + } cn, err := f.getConnection(ctx, share) if err != nil { return err } - err = cn.smbShare.MkdirAll(f.toSambaPath(path.Dir(_path)), 0o755) + err = cn.smbShare.MkdirAll(f.toSambaPath(dir), 0o755) f.putConnection(&cn) return err }