{"action":"created","comment":{"url":"https://api.github.com/repos/jenkinsci/workflow-plugin/pulls/comments/34890185","id":34890185,"diff_hunk":"@@ -287,13 +302,77 @@ private Object parseValue(StaplerRequest request) throws ServletException, IOExc\n     private Object convert(String name, ParameterValue v) throws IOException, InterruptedException {\n         if (v instanceof FileParameterValue) {\n             FileParameterValue fv = (FileParameterValue) v;\n-            FilePath fp = new FilePath(run.getRootDir()).child(name);\n-            fp.copyFrom(fv.getFile());\n-            return fp;\n+            FilePath workspace = getContext().get(FilePath.class);\n+            if (workspace != null) {\n+                FilePath fp =  workspace.child(name);\n+                fp.copyFrom(fv.getFile());\n+                return fp;\n+            } else {\n+                // This should never happen.\n+                throw new Failure(\"No workspace found in context.\");\n+            }\n         } else {\n             return v.getValue();\n         }\n     }\n \n     private static final long serialVersionUID = 1L;\n+    \n+    // TODO: replace with a call to MultipartFormDataParser.isMultipart once available in parent core\n+    private static boolean isMultipart(StaplerRequest request) {\n+        if (request == null) {\n+            return false;\n+        }\n+\n+        String contentType = request.getContentType();\n+        if (contentType == null) {\n+            return false;\n+        }\n+\n+        String[] parts = contentType.split(\";\");\n+        if (parts.length == 0) {\n+            return false;\n+        }\n+\n+        for (int i = 0; i < parts.length; i++) {\n+            if (\"multipart/form-data\".equals(parts[i])) {\n+                return true;\n+            }\n+        }\n+\n+        return false;\n+    }    \n+    \n+    // TODO: total hack to gain access to all parsedFormData from Stapler RequestImpl\n+    // It's a pity that RequestImpl makes the decision it does wrt isFormField FileItem filtering... why not let the \n+    // caller do that kind of filtering if they need it !!    \n+    private static FileItem getFileItem(StaplerRequest request, String name) throws ServletException, IOException {","path":"support/src/main/java/org/jenkinsci/plugins/workflow/support/steps/input/InputStepExecution.java","position":94,"original_position":94,"commit_id":"4960f9bc19dddeb136ef1891903c31a80cfb2bbb","original_commit_id":"4960f9bc19dddeb136ef1891903c31a80cfb2bbb","user":{"login":"kohsuke","id":50003,"avatar_url":"https://avatars.githubusercontent.com/u/50003?v=3","gravatar_id":"","url":"https://api.github.com/users/kohsuke","html_url":"https://github.com/kohsuke","followers_url":"https://api.github.com/users/kohsuke/followers","following_url":"https://api.github.com/users/kohsuke/following{/other_user}","gists_url":"https://api.github.com/users/kohsuke/gists{/gist_id}","starred_url":"https://api.github.com/users/kohsuke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kohsuke/subscriptions","organizations_url":"https://api.github.com/users/kohsuke/orgs","repos_url":"https://api.github.com/users/kohsuke/repos","events_url":"https://api.github.com/users/kohsuke/events{/privacy}","received_events_url":"https://api.github.com/users/kohsuke/received_events","type":"User","site_admin":false},"body":"I filed https://github.com/stapler/stapler/issues/52 to keep track of this task in stapler.","created_at":"2015-07-17T13:48:04Z","updated_at":"2015-07-17T13:48:04Z","html_url":"https://github.com/jenkinsci/workflow-plugin/pull/150#discussion_r34890185","pull_request_url":"https://api.github.com/repos/jenkinsci/workflow-plugin/pulls/150","_links":{"self":{"href":"https://api.github.com/repos/jenkinsci/workflow-plugin/pulls/comments/34890185"},"html":{"href":"https://github.com/jenkinsci/workflow-plugin/pull/150#discussion_r34890185"},"pull_request":{"href":"https://api.github.com/repos/jenkinsci/workflow-plugin/pulls/150"}}},"pull_request":{"url":"https://api.github.com/repos/jenkinsci/workflow-plugin/pulls/150","id":39471042,"html_url":"https://github.com/jenkinsci/workflow-plugin/pull/150","diff_url":"https://github.com/jenkinsci/workflow-plugin/pull/150.diff","patch_url":"https://github.com/jenkinsci/workflow-plugin/pull/150.patch","issue_url":"https://api.github.com/repos/jenkinsci/workflow-plugin/issues/150","number":150,"state":"open","locked":false,"title":"[FIXED JENKINS-29289] InputStep doesn't support File Parameters","user":{"login":"tfennelly","id":429311,"avatar_url":"https://avatars.githubusercontent.com/u/429311?v=3","gravatar_id":"","url":"https://api.github.com/users/tfennelly","html_url":"https://github.com/tfennelly","followers_url":"https://api.github.com/users/tfennelly/followers","following_url":"https://api.github.com/users/tfennelly/following{/other_user}","gists_url":"https://api.github.com/users/tfennelly/gists{/gist_id}","starred_url":"https://api.github.com/users/tfennelly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tfennelly/subscriptions","organizations_url":"https://api.github.com/users/tfennelly/orgs","repos_url":"https://api.github.com/users/tfennelly/repos","events_url":"https://api.github.com/users/tfennelly/events{/privacy}","received_events_url":"https://api.github.com/users/tfennelly/received_events","type":"User","site_admin":false},"body":"[See JENKINS-29289](https://issues.jenkins-ci.org/browse/JENKINS-29289)\r\n\r\n- [x] Support `multipart/form-data`\r\n- [x] `InputStepExecution` to copy File Param file to Workspace instead of build dir\r\n- [x] Add a test\r\n\r\n@reviewbybees (esp @kohsuke)\r\n\r\nThere's an ugly hack in order to get at the `parsedFormData` in the stapler `RequestImpl`. `RequestImpl.getFileItem` filters the items on behalf of the caller, which sucks imo.","created_at":"2015-07-08T12:25:17Z","updated_at":"2015-07-17T13:48:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7ea384e4ea223be88fdef2afb77bd1dad9ed7303","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jenkinsci/workflow-plugin/pulls/150/commits","review_comments_url":"https://api.github.com/repos/jenkinsci/workflow-plugin/pulls/150/comments","review_comment_url":"https://api.github.com/repos/jenkinsci/workflow-plugin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jenkinsci/workflow-plugin/issues/150/comments","statuses_url":"https://api.github.com/repos/jenkinsci/workflow-plugin/statuses/4960f9bc19dddeb136ef1891903c31a80cfb2bbb","head":{"label":"tfennelly:JENKINS-29289","ref":"JENKINS-29289","sha":"4960f9bc19dddeb136ef1891903c31a80cfb2bbb","user":{"login":"tfennelly","id":429311,"avatar_url":"https://avatars.githubusercontent.com/u/429311?v=3","gravatar_id":"","url":"https://api.github.com/users/tfennelly","html_url":"https://github.com/tfennelly","followers_url":"https://api.github.com/users/tfennelly/followers","following_url":"https://api.github.com/users/tfennelly/following{/other_user}","gists_url":"https://api.github.com/users/tfennelly/gists{/gist_id}","starred_url":"https://api.github.com/users/tfennelly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tfennelly/subscriptions","organizations_url":"https://api.github.com/users/tfennelly/orgs","repos_url":"https://api.github.com/users/tfennelly/repos","events_url":"https://api.github.com/users/tfennelly/events{/privacy}","received_events_url":"https://api.github.com/users/tfennelly/received_events","type":"User","site_admin":false},"repo":{"id":22879488,"name":"workflow-plugin","full_name":"tfennelly/workflow-plugin","owner":{"login":"tfennelly","id":429311,"avatar_url":"https://avatars.githubusercontent.com/u/429311?v=3","gravatar_id":"","url":"https://api.github.com/users/tfennelly","html_url":"https://github.com/tfennelly","followers_url":"https://api.github.com/users/tfennelly/followers","following_url":"https://api.github.com/users/tfennelly/following{/other_user}","gists_url":"https://api.github.com/users/tfennelly/gists{/gist_id}","starred_url":"https://api.github.com/users/tfennelly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tfennelly/subscriptions","organizations_url":"https://api.github.com/users/tfennelly/orgs","repos_url":"https://api.github.com/users/tfennelly/repos","events_url":"https://api.github.com/users/tfennelly/events{/privacy}","received_events_url":"https://api.github.com/users/tfennelly/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tfennelly/workflow-plugin","description":"","fork":true,"url":"https://api.github.com/repos/tfennelly/workflow-plugin","forks_url":"https://api.github.com/repos/tfennelly/workflow-plugin/forks","keys_url":"https://api.github.com/repos/tfennelly/workflow-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tfennelly/workflow-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tfennelly/workflow-plugin/teams","hooks_url":"https://api.github.com/repos/tfennelly/workflow-plugin/hooks","issue_events_url":"https://api.github.com/repos/tfennelly/workflow-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/tfennelly/workflow-plugin/events","assignees_url":"https://api.github.com/repos/tfennelly/workflow-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/tfennelly/workflow-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/tfennelly/workflow-plugin/tags","blobs_url":"https://api.github.com/repos/tfennelly/workflow-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tfennelly/workflow-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tfennelly/workflow-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/tfennelly/workflow-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tfennelly/workflow-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/tfennelly/workflow-plugin/languages","stargazers_url":"https://api.github.com/repos/tfennelly/workflow-plugin/stargazers","contributors_url":"https://api.github.com/repos/tfennelly/workflow-plugin/contributors","subscribers_url":"https://api.github.com/repos/tfennelly/workflow-plugin/subscribers","subscription_url":"https://api.github.com/repos/tfennelly/workflow-plugin/subscription","commits_url":"https://api.github.com/repos/tfennelly/workflow-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/tfennelly/workflow-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/tfennelly/workflow-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/tfennelly/workflow-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/tfennelly/workflow-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/tfennelly/workflow-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tfennelly/workflow-plugin/merges","archive_url":"https://api.github.com/repos/tfennelly/workflow-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tfennelly/workflow-plugin/downloads","issues_url":"https://api.github.com/repos/tfennelly/workflow-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/tfennelly/workflow-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/tfennelly/workflow-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/tfennelly/workflow-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tfennelly/workflow-plugin/labels{/name}","releases_url":"https://api.github.com/repos/tfennelly/workflow-plugin/releases{/id}","created_at":"2014-08-12T14:03:00Z","updated_at":"2014-08-15T07:48:55Z","pushed_at":"2015-07-10T07:33:44Z","git_url":"git://github.com/tfennelly/workflow-plugin.git","ssh_url":"git@github.com:tfennelly/workflow-plugin.git","clone_url":"https://github.com/tfennelly/workflow-plugin.git","svn_url":"https://github.com/tfennelly/workflow-plugin","homepage":"","size":3601,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"jenkinsci:master","ref":"master","sha":"727f2462606a32c026eaf716952ee0a0df7490fc","user":{"login":"jenkinsci","id":107424,"avatar_url":"https://avatars.githubusercontent.com/u/107424?v=3","gravatar_id":"","url":"https://api.github.com/users/jenkinsci","html_url":"https://github.com/jenkinsci","followers_url":"https://api.github.com/users/jenkinsci/followers","following_url":"https://api.github.com/users/jenkinsci/following{/other_user}","gists_url":"https://api.github.com/users/jenkinsci/gists{/gist_id}","starred_url":"https://api.github.com/users/jenkinsci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jenkinsci/subscriptions","organizations_url":"https://api.github.com/users/jenkinsci/orgs","repos_url":"https://api.github.com/users/jenkinsci/repos","events_url":"https://api.github.com/users/jenkinsci/events{/privacy}","received_events_url":"https://api.github.com/users/jenkinsci/received_events","type":"Organization","site_admin":false},"repo":{"id":19630847,"name":"workflow-plugin","full_name":"jenkinsci/workflow-plugin","owner":{"login":"jenkinsci","id":107424,"avatar_url":"https://avatars.githubusercontent.com/u/107424?v=3","gravatar_id":"","url":"https://api.github.com/users/jenkinsci","html_url":"https://github.com/jenkinsci","followers_url":"https://api.github.com/users/jenkinsci/followers","following_url":"https://api.github.com/users/jenkinsci/following{/other_user}","gists_url":"https://api.github.com/users/jenkinsci/gists{/gist_id}","starred_url":"https://api.github.com/users/jenkinsci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jenkinsci/subscriptions","organizations_url":"https://api.github.com/users/jenkinsci/orgs","repos_url":"https://api.github.com/users/jenkinsci/repos","events_url":"https://api.github.com/users/jenkinsci/events{/privacy}","received_events_url":"https://api.github.com/users/jenkinsci/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/jenkinsci/workflow-plugin","description":"Jenkins workflow plugin","fork":false,"url":"https://api.github.com/repos/jenkinsci/workflow-plugin","forks_url":"https://api.github.com/repos/jenkinsci/workflow-plugin/forks","keys_url":"https://api.github.com/repos/jenkinsci/workflow-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jenkinsci/workflow-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jenkinsci/workflow-plugin/teams","hooks_url":"https://api.github.com/repos/jenkinsci/workflow-plugin/hooks","issue_events_url":"https://api.github.com/repos/jenkinsci/workflow-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/jenkinsci/workflow-plugin/events","assignees_url":"https://api.github.com/repos/jenkinsci/workflow-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/jenkinsci/workflow-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/jenkinsci/workflow-plugin/tags","blobs_url":"https://api.github.com/repos/jenkinsci/workflow-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jenkinsci/workflow-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jenkinsci/workflow-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/jenkinsci/workflow-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jenkinsci/workflow-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/jenkinsci/workflow-plugin/languages","stargazers_url":"https://api.github.com/repos/jenkinsci/workflow-plugin/stargazers","contributors_url":"https://api.github.com/repos/jenkinsci/workflow-plugin/contributors","subscribers_url":"https://api.github.com/repos/jenkinsci/workflow-plugin/subscribers","subscription_url":"https://api.github.com/repos/jenkinsci/workflow-plugin/subscription","commits_url":"https://api.github.com/repos/jenkinsci/workflow-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/jenkinsci/workflow-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/jenkinsci/workflow-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/jenkinsci/workflow-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/jenkinsci/workflow-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/jenkinsci/workflow-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jenkinsci/workflow-plugin/merges","archive_url":"https://api.github.com/repos/jenkinsci/workflow-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jenkinsci/workflow-plugin/downloads","issues_url":"https://api.github.com/repos/jenkinsci/workflow-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/jenkinsci/workflow-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/jenkinsci/workflow-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/jenkinsci/workflow-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jenkinsci/workflow-plugin/labels{/name}","releases_url":"https://api.github.com/repos/jenkinsci/workflow-plugin/releases{/id}","created_at":"2014-05-10T01:47:09Z","updated_at":"2015-07-16T16:51:46Z","pushed_at":"2015-07-17T10:32:29Z","git_url":"git://github.com/jenkinsci/workflow-plugin.git","ssh_url":"git@github.com:jenkinsci/workflow-plugin.git","clone_url":"https://github.com/jenkinsci/workflow-plugin.git","svn_url":"https://github.com/jenkinsci/workflow-plugin","homepage":"https://wiki.jenkins-ci.org/display/JENKINS/Workflow+Plugin","size":7480,"stargazers_count":342,"watchers_count":342,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":80,"mirror_url":null,"open_issues_count":11,"forks":80,"open_issues":11,"watchers":342,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jenkinsci/workflow-plugin/pulls/150"},"html":{"href":"https://github.com/jenkinsci/workflow-plugin/pull/150"},"issue":{"href":"https://api.github.com/repos/jenkinsci/workflow-plugin/issues/150"},"comments":{"href":"https://api.github.com/repos/jenkinsci/workflow-plugin/issues/150/comments"},"review_comments":{"href":"https://api.github.com/repos/jenkinsci/workflow-plugin/pulls/150/comments"},"review_comment":{"href":"https://api.github.com/repos/jenkinsci/workflow-plugin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jenkinsci/workflow-plugin/pulls/150/commits"},"statuses":{"href":"https://api.github.com/repos/jenkinsci/workflow-plugin/statuses/4960f9bc19dddeb136ef1891903c31a80cfb2bbb"}}}}