提交 76b45518 编写于 作者: K Kohsuke Kawaguchi

expose the submitted file name

上级 c4d36adb
......@@ -86,12 +86,21 @@ public class FileParameterDefinition extends ParameterDefinition {
// the requested file parameter wasn't uploaded
return null;
}
FileParameterValue p = new FileParameterValue(getName(), src);
FileParameterValue p = new FileParameterValue(getName(), src, getFileName(src.getName()));
p.setDescription(getDescription());
p.setLocation(getName());
return p;
}
/**
* Strip off the path portion if the given path contains it.
*/
private String getFileName(String possiblyPathName) {
possiblyPathName = possiblyPathName.substring(possiblyPathName.lastIndexOf('/')+1);
possiblyPathName = possiblyPathName.substring(possiblyPathName.lastIndexOf('\\')+1);
return possiblyPathName;
}
@Override
public ParameterValue createValue(CLICommand command, String value) throws IOException, InterruptedException {
// capture the file to the server
......
......@@ -8,8 +8,17 @@
place the file.</li>
<li>Perform data processing by uploading a dataset.</li>
</ol>
<p>It is possible to not submit any file. If it's case and if no file is
already present at the specified location in the workspace, then nothing
happens. If there's already a file present in the workspace, then this file
will be kept as-is.</p>
<p>
The name of the submitted file is available in the environment variable
whose name is the same as file location. For example, if you set the file
location to be <tt>abc.zip</tt>, then <tt>${abc.zip}</tt> would give you
the original file name passed from the browser (such as <tt>my.zip</tt>.)
The name will not include the directory name portion.
</p>
<p>
File upload is optional. If a user chooses not to upload anything,
Jenkins will simply skips this parameter and will not place
anything (but it also will not delete anything that's already in the
workspace.)
</p>
</div>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册