Aliases should not start by a slash (#1786)

This commit is contained in:
Anis Elleuch
2016-08-05 09:09:51 -07:00
committed by Harshavardhana
parent 75de34de90
commit f6ca45c384
2 changed files with 7 additions and 4 deletions
+6 -3
View File
@@ -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)
+1 -1
View File
@@ -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.")
}