From ef22ffd2b0a6ee945d65affa3ef7ea1ef7986100 Mon Sep 17 00:00:00 2001 From: zhongkaizhu Date: Tue, 10 Sep 2024 17:37:22 +0800 Subject: [PATCH] Fix push dir failed when withSrcDir is false (#21) --- sync.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sync.go b/sync.go index 3adaa27..3ba7a95 100644 --- a/sync.go +++ b/sync.go @@ -317,17 +317,16 @@ func MakeDirs(c *Device, local string, remote string, withSrcDir bool) (err erro if err != nil { return } - var remoteSubDirs []string + remoteSubDirs := make([]string, 1+len(subdirs)) if baseName != "" { - remoteSubDirs = make([]string, 1+len(subdirs)) remoteSubDirs[0] = remote + "/" + baseName for i, d := range subdirs { remoteSubDirs[i+1] = remote + "/" + baseName + "/" + d } } else { - remoteSubDirs = make([]string, len(subdirs)) + remoteSubDirs[0] = remote for i, d := range subdirs { - remoteSubDirs[i] = remote + "/" + d + remoteSubDirs[i+1] = remote + "/" + d } } err = c.MkdirsWithParent(remoteSubDirs, true)