mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-04 23:17:50 +00:00
fix kubectl cp command error.
it happens when copy directory to pod and the directory path ends with '/'. for example: kubectl cp /XX/XX/ XX-POD:/XX/XX modified: pkg/kubectl/cmd/cp.go modified: pkg/kubectl/cmd/cp_test.go
This commit is contained in:
@@ -195,6 +195,8 @@ func makeTar(filepath string, writer io.Writer) error {
|
||||
// TODO: use compression here?
|
||||
tarWriter := tar.NewWriter(writer)
|
||||
defer tarWriter.Close()
|
||||
|
||||
filepath = path.Clean(filepath)
|
||||
return recursiveTar(path.Dir(filepath), path.Base(filepath), tarWriter)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user