mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-07 09:06:03 +00:00
Making FilePathFilter itself more composable
This commit is contained in:
1 parent
11b240c361
commit
c20308c3fa
5 files changed
+152
-50
No files matched your search
@@ -57,6 +57,7 @@ import hudson.util.io.ArchiverFactory;
|
||||
import jenkins.FilePathFilter;
|
||||
import jenkins.MasterToSlaveFileCallable;
|
||||
import jenkins.SlaveToMasterFileCallable;
|
||||
import jenkins.SoloFilePathFilter;
|
||||
import jenkins.model.Jenkins;
|
||||
import jenkins.security.MasterToSlaveCallable;
|
||||
import jenkins.util.VirtualFile;
|
||||
@@ -208,7 +209,8 @@ public final class FilePath implements Serializable {
|
||||
*
|
||||
* @see #filterNonNull()
|
||||
*/
|
||||
private transient @Nullable FilePathFilter filter;
|
||||
private transient @Nullable
|
||||
SoloFilePathFilter filter;
|
||||
|
||||
/**
|
||||
* Creates a {@link FilePath} that represents a path on the given node.
|
||||
@@ -2503,7 +2505,7 @@ public final class FilePath implements Serializable {
|
||||
// we need to make sure the access control takes place.
|
||||
// This covers the immediate case of FileCallables taking FilePath into reference closure implicitly,
|
||||
// but it also covers more general case of FilePath sent as a return value or argument.
|
||||
this.filter = FilePathFilter.current();
|
||||
this.filter = SoloFilePathFilter.wrap(FilePathFilter.current());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2624,8 +2626,8 @@ public final class FilePath implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
private @Nonnull FilePathFilter filterNonNull() {
|
||||
return filter!=null ? filter : FilePathFilter.EMPTY;
|
||||
private @Nonnull SoloFilePathFilter filterNonNull() {
|
||||
return filter!=null ? filter : UNRESTRICTED;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2705,4 +2707,6 @@ public final class FilePath implements Serializable {
|
||||
filterNonNull().mkdirs(dir);
|
||||
return dir.mkdirs();
|
||||
}
|
||||
|
||||
private static final SoloFilePathFilter UNRESTRICTED = SoloFilePathFilter.wrap(FilePathFilter.UNRESTRICTED);
|
||||
}
|
||||
Reference in new issue
Block a user