From f6ca45c3846bebdc61a184f19b2e2dc8ea975a64 Mon Sep 17 00:00:00 2001 From: Anis Elleuch Date: Fri, 5 Aug 2016 18:09:51 +0200 Subject: [PATCH] Aliases should not start by a slash (#1786) --- client-url.go | 9 ++++++--- session-main.go | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/client-url.go b/client-url.go index bae5e9df..b0612bac 100644 --- a/client-url.go +++ b/client-url.go @@ -190,7 +190,7 @@ func url2Stat(urlStr string) (client Client, content *clientContent, err *probe. } // url2Alias separates alias and path from the URL. Aliased URL is of -// the form [/]alias/path/to/blah. +// the form alias/path/to/blah. func url2Alias(aliasedURL string) (alias, path string) { // Save aliased url. urlStr := aliasedURL @@ -198,8 +198,11 @@ func url2Alias(aliasedURL string) (alias, path string) { // Convert '/' on windows to filepath.Separator. urlStr = filepath.FromSlash(urlStr) - // Remove '/' prefix before alias, if any. - urlStr = strings.TrimPrefix(urlStr, string(filepath.Separator)) + if runtime.GOOS == "windows" { + // Remove '/' prefix before alias if any to support '\\home' alias + // style under Windows + urlStr = strings.TrimPrefix(urlStr, string(filepath.Separator)) + } // Remove everything after alias (i.e. after '/'). urlParts := strings.SplitN(urlStr, string(filepath.Separator), 2) diff --git a/session-main.go b/session-main.go index 98d5598d..ad1aa488 100644 --- a/session-main.go +++ b/session-main.go @@ -114,7 +114,7 @@ func (c clearSessionMessage) String() string { var colorizedMsg string switch c.Status { case "success": - colorizedMsg = console.Colorize("ClearSession", msg+" cleared succesfully.") + colorizedMsg = console.Colorize("ClearSession", msg+" cleared successfully.") case "forced": colorizedMsg = console.Colorize("ClearSession", msg+" cleared forcefully.") }