Unverified Commit 64b96d42 authored by k8s-ci-robot's avatar k8s-ci-robot Committed by GitHub

Merge pull request #69885 from clickyotomy/master

Fix local copy path for `kubectl cp'.
parents 2e80c3a0 00720ba5
......@@ -315,8 +315,8 @@ func stripPathShortcuts(p string) string {
trimmed = strings.TrimPrefix(newPath, "../")
}
// trim leftover ".."
if newPath == ".." {
// trim leftover {".", ".."}
if newPath == "." || newPath == ".." {
newPath = ""
}
......
......@@ -175,6 +175,11 @@ func TestStripPathShortcuts(t *testing.T) {
input: "...foo",
expected: "...foo",
},
{
name: "test root directory",
input: "/",
expected: "",
},
}
for _, test := range tests {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment