mirror of https://github.com/k3s-io/k3s
Merge pull request #69885 from clickyotomy/master
Fix local copy path for `kubectl cp'.pull/564/head
commit
64b96d426a
|
@ -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) {
|
||||||
input: "...foo",
|
input: "...foo",
|
||||||
expected: "...foo",
|
expected: "...foo",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "test root directory",
|
||||||
|
input: "/",
|
||||||
|
expected: "",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
|
|
Loading…
Reference in New Issue