Skip to content

Commit 2de5fa6

Browse files
authored
Merge pull request #1809 from stgraber/main
incus/file: Properly handle relative source paths
2 parents 20c0132 + 7fa00dc commit 2de5fa6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cmd/incus/file.go

+6
Original file line numberDiff line numberDiff line change
@@ -1180,9 +1180,15 @@ func (c *cmdFile) recursivePullFile(sftpConn *sftp.Client, p string, targetDir s
11801180

11811181
func (c *cmdFile) recursivePushFile(sftpConn *sftp.Client, source string, target string) error {
11821182
source = filepath.Clean(source)
1183+
11831184
sourceDir, _ := filepath.Split(source)
11841185
sourceLen := len(sourceDir)
11851186

1187+
// Special handling for relative paths.
1188+
if source == ".." {
1189+
sourceLen = 1
1190+
}
1191+
11861192
sendFile := func(p string, fInfo os.FileInfo, err error) error {
11871193
if err != nil {
11881194
return fmt.Errorf(i18n.G("Failed to walk path for %s: %s"), p, err)

0 commit comments

Comments
 (0)