From 09dde380f906b943eb834b7b93c1afa0c2e49b46 Mon Sep 17 00:00:00 2001 From: Evgeny Danienko <6655321@bk.ru> Date: Tue, 25 Sep 2018 15:54:47 +0300 Subject: cmd/swarm: use expandPath for swarm cli path parameters --- cmd/swarm/upload.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'cmd/swarm/upload.go') diff --git a/cmd/swarm/upload.go b/cmd/swarm/upload.go index 9eae2a3f8..f76cb1b98 100644 --- a/cmd/swarm/upload.go +++ b/cmd/swarm/upload.go @@ -138,6 +138,12 @@ func upload(ctx *cli.Context) { // 3. cleans the path, e.g. /a/b/../c -> /a/c // Note, it has limitations, e.g. ~someuser/tmp will not be expanded func expandPath(p string) string { + if i := strings.Index(p, ":"); i > 0 { + return p + } + if i := strings.Index(p, "@"); i > 0 { + return p + } if strings.HasPrefix(p, "~/") || strings.HasPrefix(p, "~\\") { if home := homeDir(); home != "" { p = home + p[1:] -- cgit