{"action":"created","comment":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments/173481102","pull_request_review_id":102684543,"id":173481102,"diff_hunk":"@@ -162,13 +162,13 @@ func checkDestinationIsDir(dest fileSpec, f cmdutil.Factory, cmd *cobra.Command)\n }\n \n func copyToPod(f cmdutil.Factory, cmd *cobra.Command, stdout, stderr io.Writer, src, dest fileSpec) error {\n-\tif len(src.File) == 0 {\n+\tif len(src.File) == 0 || len(dest.File) == 0 {\n \t\treturn errFileCannotBeEmpty\n \t}\n \treader, writer := io.Pipe()\n \n \t// strip trailing slash (if any)\n-\tif strings.HasSuffix(string(dest.File[len(dest.File)-1]), \"/\") {\n+\tif len(dest.File) > 1 && strings.HasSuffix(string(dest.File[len(dest.File)-1]), \"/\") {","path":"pkg/kubectl/cmd/cp.go","position":12,"original_position":12,"commit_id":"fb65936fffec470e326c190282619540b462ed7b","original_commit_id":"fb65936fffec470e326c190282619540b462ed7b","user":{"login":"juanvallejo","id":3902875,"avatar_url":"https://avatars2.githubusercontent.com/u/3902875?v=4","gravatar_id":"","url":"https://api.github.com/users/juanvallejo","html_url":"https://github.com/juanvallejo","followers_url":"https://api.github.com/users/juanvallejo/followers","following_url":"https://api.github.com/users/juanvallejo/following{/other_user}","gists_url":"https://api.github.com/users/juanvallejo/gists{/gist_id}","starred_url":"https://api.github.com/users/juanvallejo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juanvallejo/subscriptions","organizations_url":"https://api.github.com/users/juanvallejo/orgs","repos_url":"https://api.github.com/users/juanvallejo/repos","events_url":"https://api.github.com/users/juanvallejo/events{/privacy}","received_events_url":"https://api.github.com/users/juanvallejo/received_events","type":"User","site_admin":false},"body":"`len(dest.File) > 0`?","created_at":"2018-03-09T15:29:33Z","updated_at":"2018-03-09T15:29:33Z","html_url":"https://github.com/kubernetes/kubernetes/pull/60565#discussion_r173481102","pull_request_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/60565","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments/173481102"},"html":{"href":"https://github.com/kubernetes/kubernetes/pull/60565#discussion_r173481102"},"pull_request":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/60565"}}},"pull_request":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/60565","id":171883821,"html_url":"https://github.com/kubernetes/kubernetes/pull/60565","diff_url":"https://github.com/kubernetes/kubernetes/pull/60565.diff","patch_url":"https://github.com/kubernetes/kubernetes/pull/60565.patch","issue_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/60565","number":60565,"state":"open","locked":false,"title":"kubectl cp command bug fix","user":{"login":"WanLinghao","id":13160186,"avatar_url":"https://avatars3.githubusercontent.com/u/13160186?v=4","gravatar_id":"","url":"https://api.github.com/users/WanLinghao","html_url":"https://github.com/WanLinghao","followers_url":"https://api.github.com/users/WanLinghao/followers","following_url":"https://api.github.com/users/WanLinghao/following{/other_user}","gists_url":"https://api.github.com/users/WanLinghao/gists{/gist_id}","starred_url":"https://api.github.com/users/WanLinghao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WanLinghao/subscriptions","organizations_url":"https://api.github.com/users/WanLinghao/orgs","repos_url":"https://api.github.com/users/WanLinghao/repos","events_url":"https://api.github.com/users/WanLinghao/events{/privacy}","received_events_url":"https://api.github.com/users/WanLinghao/received_events","type":"User","site_admin":false},"body":"\r\n\r\n<!--  Thanks for sending a pull request!  Here are some tips for you:\r\n1. If this is your first time, read our contributor guidelines https://git.k8s.io/community/contributors/devel/pull-requests.md#the-pr-submit-process and developer guide https://git.k8s.io/community/contributors/devel/development.md#development-guide\r\n2. If you want *faster* PR reviews, read how: https://git.k8s.io/community/contributors/devel/pull-requests.md#best-practices-for-faster-reviews\r\n3. Follow the instructions for writing a release note: https://git.k8s.io/community/contributors/devel/pull-requests.md#write-release-notes-if-needed\r\n4. If the PR is unfinished, see how to mark it: https://github.com/kubernetes/community/blob/master/contributors/devel/pull-requests.md#marking-unfinished-pull-requests\r\n-->\r\n\r\n**What this PR does / why we need it**:\r\n\twhen copy file from host to pod like this:\t\r\n        1.kubectl copy /tmp/test-file test-pod:/\r\n\t2.kubectl copy /tmp/test-file test-pod:\r\n\texample 1 will fail, example 2 will cause a panic.\r\n\tThis patch fix bugs above.\r\n\r\n\r\n**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:\r\nFixes #60564\r\n\r\n**Special notes for your reviewer**:\r\n\r\n**Release note**:\r\n<!--  Write your release note:\r\n1. Enter your extended release note in the below block. If the PR requires additional action from users switching to the new release, include the string \"action required\".\r\n2. If no release note is required, just write \"NONE\".\r\n-->\r\n```release-note\r\nNONE\r\n```\r\n","created_at":"2018-02-28T08:21:39Z","updated_at":"2018-03-09T15:29:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"52ee92fbfa1ed0c061d4b050edd0673a04eae7a7","assignee":{"login":"soltysh","id":576341,"avatar_url":"https://avatars2.githubusercontent.com/u/576341?v=4","gravatar_id":"","url":"https://api.github.com/users/soltysh","html_url":"https://github.com/soltysh","followers_url":"https://api.github.com/users/soltysh/followers","following_url":"https://api.github.com/users/soltysh/following{/other_user}","gists_url":"https://api.github.com/users/soltysh/gists{/gist_id}","starred_url":"https://api.github.com/users/soltysh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/soltysh/subscriptions","organizations_url":"https://api.github.com/users/soltysh/orgs","repos_url":"https://api.github.com/users/soltysh/repos","events_url":"https://api.github.com/users/soltysh/events{/privacy}","received_events_url":"https://api.github.com/users/soltysh/received_events","type":"User","site_admin":false},"assignees":[{"login":"soltysh","id":576341,"avatar_url":"https://avatars2.githubusercontent.com/u/576341?v=4","gravatar_id":"","url":"https://api.github.com/users/soltysh","html_url":"https://github.com/soltysh","followers_url":"https://api.github.com/users/soltysh/followers","following_url":"https://api.github.com/users/soltysh/following{/other_user}","gists_url":"https://api.github.com/users/soltysh/gists{/gist_id}","starred_url":"https://api.github.com/users/soltysh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/soltysh/subscriptions","organizations_url":"https://api.github.com/users/soltysh/orgs","repos_url":"https://api.github.com/users/soltysh/repos","events_url":"https://api.github.com/users/soltysh/events{/privacy}","received_events_url":"https://api.github.com/users/soltysh/received_events","type":"User","site_admin":false}],"requested_reviewers":[{"login":"mengqiy","id":2589105,"avatar_url":"https://avatars1.githubusercontent.com/u/2589105?v=4","gravatar_id":"","url":"https://api.github.com/users/mengqiy","html_url":"https://github.com/mengqiy","followers_url":"https://api.github.com/users/mengqiy/followers","following_url":"https://api.github.com/users/mengqiy/following{/other_user}","gists_url":"https://api.github.com/users/mengqiy/gists{/gist_id}","starred_url":"https://api.github.com/users/mengqiy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mengqiy/subscriptions","organizations_url":"https://api.github.com/users/mengqiy/orgs","repos_url":"https://api.github.com/users/mengqiy/repos","events_url":"https://api.github.com/users/mengqiy/events{/privacy}","received_events_url":"https://api.github.com/users/mengqiy/received_events","type":"User","site_admin":false},{"login":"rootfs","id":7062400,"avatar_url":"https://avatars0.githubusercontent.com/u/7062400?v=4","gravatar_id":"","url":"https://api.github.com/users/rootfs","html_url":"https://github.com/rootfs","followers_url":"https://api.github.com/users/rootfs/followers","following_url":"https://api.github.com/users/rootfs/following{/other_user}","gists_url":"https://api.github.com/users/rootfs/gists{/gist_id}","starred_url":"https://api.github.com/users/rootfs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rootfs/subscriptions","organizations_url":"https://api.github.com/users/rootfs/orgs","repos_url":"https://api.github.com/users/rootfs/repos","events_url":"https://api.github.com/users/rootfs/events{/privacy}","received_events_url":"https://api.github.com/users/rootfs/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":477397086,"url":"https://api.github.com/repos/kubernetes/kubernetes/labels/cncf-cla:%20yes","name":"cncf-cla: yes","color":"bfe5bf","default":false},{"id":349530249,"url":"https://api.github.com/repos/kubernetes/kubernetes/labels/release-note-none","name":"release-note-none","color":"c2e0c6","default":false},{"id":253450793,"url":"https://api.github.com/repos/kubernetes/kubernetes/labels/size/XS","name":"size/XS","color":"009900","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/60565/commits","review_comments_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/60565/comments","review_comment_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/60565/comments","statuses_url":"https://api.github.com/repos/kubernetes/kubernetes/statuses/fb65936fffec470e326c190282619540b462ed7b","head":{"label":"WanLinghao:kubectl_cp_slash","ref":"kubectl_cp_slash","sha":"fb65936fffec470e326c190282619540b462ed7b","user":{"login":"WanLinghao","id":13160186,"avatar_url":"https://avatars3.githubusercontent.com/u/13160186?v=4","gravatar_id":"","url":"https://api.github.com/users/WanLinghao","html_url":"https://github.com/WanLinghao","followers_url":"https://api.github.com/users/WanLinghao/followers","following_url":"https://api.github.com/users/WanLinghao/following{/other_user}","gists_url":"https://api.github.com/users/WanLinghao/gists{/gist_id}","starred_url":"https://api.github.com/users/WanLinghao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WanLinghao/subscriptions","organizations_url":"https://api.github.com/users/WanLinghao/orgs","repos_url":"https://api.github.com/users/WanLinghao/repos","events_url":"https://api.github.com/users/WanLinghao/events{/privacy}","received_events_url":"https://api.github.com/users/WanLinghao/received_events","type":"User","site_admin":false},"repo":{"id":98487864,"name":"kubernetes","full_name":"WanLinghao/kubernetes","owner":{"login":"WanLinghao","id":13160186,"avatar_url":"https://avatars3.githubusercontent.com/u/13160186?v=4","gravatar_id":"","url":"https://api.github.com/users/WanLinghao","html_url":"https://github.com/WanLinghao","followers_url":"https://api.github.com/users/WanLinghao/followers","following_url":"https://api.github.com/users/WanLinghao/following{/other_user}","gists_url":"https://api.github.com/users/WanLinghao/gists{/gist_id}","starred_url":"https://api.github.com/users/WanLinghao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WanLinghao/subscriptions","organizations_url":"https://api.github.com/users/WanLinghao/orgs","repos_url":"https://api.github.com/users/WanLinghao/repos","events_url":"https://api.github.com/users/WanLinghao/events{/privacy}","received_events_url":"https://api.github.com/users/WanLinghao/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/WanLinghao/kubernetes","description":"Production-Grade Container Scheduling and Management","fork":true,"url":"https://api.github.com/repos/WanLinghao/kubernetes","forks_url":"https://api.github.com/repos/WanLinghao/kubernetes/forks","keys_url":"https://api.github.com/repos/WanLinghao/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/WanLinghao/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/WanLinghao/kubernetes/teams","hooks_url":"https://api.github.com/repos/WanLinghao/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/WanLinghao/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/WanLinghao/kubernetes/events","assignees_url":"https://api.github.com/repos/WanLinghao/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/WanLinghao/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/WanLinghao/kubernetes/tags","blobs_url":"https://api.github.com/repos/WanLinghao/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/WanLinghao/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/WanLinghao/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/WanLinghao/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/WanLinghao/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/WanLinghao/kubernetes/languages","stargazers_url":"https://api.github.com/repos/WanLinghao/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/WanLinghao/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/WanLinghao/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/WanLinghao/kubernetes/subscription","commits_url":"https://api.github.com/repos/WanLinghao/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/WanLinghao/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/WanLinghao/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/WanLinghao/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/WanLinghao/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/WanLinghao/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/WanLinghao/kubernetes/merges","archive_url":"https://api.github.com/repos/WanLinghao/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/WanLinghao/kubernetes/downloads","issues_url":"https://api.github.com/repos/WanLinghao/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/WanLinghao/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/WanLinghao/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/WanLinghao/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/WanLinghao/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/WanLinghao/kubernetes/releases{/id}","deployments_url":"https://api.github.com/repos/WanLinghao/kubernetes/deployments","created_at":"2017-07-27T03:02:23Z","updated_at":"2017-07-27T03:03:05Z","pushed_at":"2018-03-06T05:51:25Z","git_url":"git://github.com/WanLinghao/kubernetes.git","ssh_url":"git@github.com:WanLinghao/kubernetes.git","clone_url":"https://github.com/WanLinghao/kubernetes.git","svn_url":"https://github.com/WanLinghao/kubernetes","homepage":"http://kubernetes.io","size":536729,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"kubernetes:master","ref":"master","sha":"cd78e999f9aade259c177c1698129311c83aa7d3","user":{"login":"kubernetes","id":13629408,"avatar_url":"https://avatars2.githubusercontent.com/u/13629408?v=4","gravatar_id":"","url":"https://api.github.com/users/kubernetes","html_url":"https://github.com/kubernetes","followers_url":"https://api.github.com/users/kubernetes/followers","following_url":"https://api.github.com/users/kubernetes/following{/other_user}","gists_url":"https://api.github.com/users/kubernetes/gists{/gist_id}","starred_url":"https://api.github.com/users/kubernetes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubernetes/subscriptions","organizations_url":"https://api.github.com/users/kubernetes/orgs","repos_url":"https://api.github.com/users/kubernetes/repos","events_url":"https://api.github.com/users/kubernetes/events{/privacy}","received_events_url":"https://api.github.com/users/kubernetes/received_events","type":"Organization","site_admin":false},"repo":{"id":20580498,"name":"kubernetes","full_name":"kubernetes/kubernetes","owner":{"login":"kubernetes","id":13629408,"avatar_url":"https://avatars2.githubusercontent.com/u/13629408?v=4","gravatar_id":"","url":"https://api.github.com/users/kubernetes","html_url":"https://github.com/kubernetes","followers_url":"https://api.github.com/users/kubernetes/followers","following_url":"https://api.github.com/users/kubernetes/following{/other_user}","gists_url":"https://api.github.com/users/kubernetes/gists{/gist_id}","starred_url":"https://api.github.com/users/kubernetes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubernetes/subscriptions","organizations_url":"https://api.github.com/users/kubernetes/orgs","repos_url":"https://api.github.com/users/kubernetes/repos","events_url":"https://api.github.com/users/kubernetes/events{/privacy}","received_events_url":"https://api.github.com/users/kubernetes/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kubernetes/kubernetes","description":"Production-Grade Container Scheduling and Management","fork":false,"url":"https://api.github.com/repos/kubernetes/kubernetes","forks_url":"https://api.github.com/repos/kubernetes/kubernetes/forks","keys_url":"https://api.github.com/repos/kubernetes/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kubernetes/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kubernetes/kubernetes/teams","hooks_url":"https://api.github.com/repos/kubernetes/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/kubernetes/kubernetes/events","assignees_url":"https://api.github.com/repos/kubernetes/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/kubernetes/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/kubernetes/kubernetes/tags","blobs_url":"https://api.github.com/repos/kubernetes/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kubernetes/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kubernetes/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/kubernetes/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kubernetes/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/kubernetes/kubernetes/languages","stargazers_url":"https://api.github.com/repos/kubernetes/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/kubernetes/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/kubernetes/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/kubernetes/kubernetes/subscription","commits_url":"https://api.github.com/repos/kubernetes/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/kubernetes/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/kubernetes/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/kubernetes/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kubernetes/kubernetes/merges","archive_url":"https://api.github.com/repos/kubernetes/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kubernetes/kubernetes/downloads","issues_url":"https://api.github.com/repos/kubernetes/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/kubernetes/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/kubernetes/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kubernetes/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/kubernetes/kubernetes/releases{/id}","deployments_url":"https://api.github.com/repos/kubernetes/kubernetes/deployments","created_at":"2014-06-06T22:56:04Z","updated_at":"2018-03-09T15:22:48Z","pushed_at":"2018-03-09T15:29:20Z","git_url":"git://github.com/kubernetes/kubernetes.git","ssh_url":"git@github.com:kubernetes/kubernetes.git","clone_url":"https://github.com/kubernetes/kubernetes.git","svn_url":"https://github.com/kubernetes/kubernetes","homepage":"http://kubernetes.io","size":763681,"stargazers_count":33517,"watchers_count":33517,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":11898,"mirror_url":null,"archived":false,"open_issues_count":3821,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":11898,"open_issues":3821,"watchers":33517,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/60565"},"html":{"href":"https://github.com/kubernetes/kubernetes/pull/60565"},"issue":{"href":"https://api.github.com/repos/kubernetes/kubernetes/issues/60565"},"comments":{"href":"https://api.github.com/repos/kubernetes/kubernetes/issues/60565/comments"},"review_comments":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/60565/comments"},"review_comment":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/60565/commits"},"statuses":{"href":"https://api.github.com/repos/kubernetes/kubernetes/statuses/fb65936fffec470e326c190282619540b462ed7b"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"juanvallejo"}}