[lxc-devel] [lxd/master] Fix #3240 - file push broken on windows with 2.13

techtonik on Github lxc-bot at linuxcontainers.org
Thu Apr 27 20:49:26 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 355 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170427/eaeb1767/attachment.bin>
-------------- next part --------------
From e0090661fa39692fccfbd6e2338e9ac95b69efec Mon Sep 17 00:00:00 2001
From: anatoly techtonik <techtonik at gmail.com>
Date: Thu, 27 Apr 2017 23:46:25 +0300
Subject: [PATCH] Fix #3240 - file push broken on windows with 2.13

Signed-off-by: anatoly techtonik <techtonik at gmail.com>
---
 lxc/file.go | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/lxc/file.go b/lxc/file.go
index dc1051a..679c00e 100644
--- a/lxc/file.go
+++ b/lxc/file.go
@@ -6,7 +6,6 @@ import (
 	"io/ioutil"
 	"os"
 	"path"
-	"path/filepath"
 	"strconv"
 	"strings"
 	"syscall"
@@ -87,10 +86,8 @@ func (c *fileCmd) push(config *lxd.Config, send_file_perms bool, args []string)
 	// re-add leading / that got stripped by the SplitN
 	targetPath := "/" + pathSpec[1]
 	// clean various /./, /../, /////, etc. that users add (#2557)
-	targetPath, err := filepath.Abs(targetPath)
-	if err != nil {
-		return fmt.Errorf(i18n.G("Could not sanitize path %s"), targetPath)
-	}
+	targetPath = path.Clean(targetPath)
+
 	// normalization may reveal that path is still a dir, e.g. /.
 	if strings.HasSuffix(targetPath, "/") {
 		targetIsDir = true


More information about the lxc-devel mailing list