Merge pull request #69885 from clickyotomy/master

Fix local copy path for `kubectl cp'.
pull/564/head
k8s-ci-robot 2018-11-28 23:31:21 -08:00 committed by GitHub
commit 64b96d426a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -315,8 +315,8 @@ func stripPathShortcuts(p string) string {
trimmed = strings.TrimPrefix(newPath, "../")
}
// trim leftover ".."
if newPath == ".." {
// trim leftover {".", ".."}
if newPath == "." || newPath == ".." {
newPath = ""
}

View File

@ -175,6 +175,11 @@ func TestStripPathShortcuts(t *testing.T) {
input: "...foo",
expected: "...foo",
},
{
name: "test root directory",
input: "/",
expected: "",
},
}
for _, test := range tests {