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 { ...@@ -315,8 +315,8 @@ func stripPathShortcuts(p string) string {
trimmed = strings.TrimPrefix(newPath, "../") trimmed = strings.TrimPrefix(newPath, "../")
} }
// trim leftover ".." // trim leftover {".", ".."}
if newPath == ".." { if newPath == "." || newPath == ".." {
newPath = "" newPath = ""
} }
......
...@@ -175,6 +175,11 @@ func TestStripPathShortcuts(t *testing.T) { ...@@ -175,6 +175,11 @@ func TestStripPathShortcuts(t *testing.T) {
input: "...foo", input: "...foo",
expected: "...foo", expected: "...foo",
}, },
{
name: "test root directory",
input: "/",
expected: "",
},
} }
for _, test := range tests { 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