Skip to content

Commit 646b803

Browse files
committed
do not restrict the original filename
There is no reason to not allow any character here that is allowed in the file system. This is only used to set the value of an environment variable.
1 parent 69e65a6 commit 646b803

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/main/java/io/jenkins/plugins/file_parameters/AbstractFileParameterValue.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import hudson.model.ParameterValue;
3535
import hudson.model.Run;
3636
import hudson.model.TaskListener;
37+
import java.io.File;
3738
import java.io.FilterInputStream;
3839
import java.io.IOException;
3940
import java.io.InputStream;
@@ -59,14 +60,9 @@ public final String getFilename() {
5960
}
6061

6162
final void setFilename(String filename) {
62-
try {
63-
Jenkins.checkGoodName(filename);
64-
this.filename = filename;
65-
} catch (Failure x) {
66-
// Ignore and leave the filename undefined.
67-
// FileItem.getName Javadoc claims Opera might pass a full path.
68-
// This is a best effort anyway (scripts should be written to tolerate an undefined name).
69-
}
63+
// FileItem.getName Javadoc claims Opera might pass a full path, so strip to just the name.
64+
// This is a best effort anyway (scripts should be written to tolerate an undefined name).
65+
this.filename = new File(filename).getName();
7066
}
7167

7268
protected InputStream open(@CheckForNull Run<?,?> build) throws IOException, InterruptedException {

0 commit comments

Comments
 (0)