mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-17 14:02:22 +00:00
[FiXED JENKINS-27055] <BUILDID> should now also match numeric build IDs.
This commit is contained in:
1 parent
9ac2257d0a
commit
20c458d993
2 files changed
+10
-2
No files matched your search
@@ -40,7 +40,7 @@ class FilePathRuleConfig extends ConfigDirectory<FilePathRule,List<FilePathRule>
|
||||
if (line.isEmpty()) return null;
|
||||
|
||||
line = line.replace("<BUILDDIR>","<JOBDIR>/builds/<BUILDID>");
|
||||
line = line.replace("<BUILDID>","[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]_[0-9][0-9]-[0-9][0-9]-[0-9][0-9]");
|
||||
line = line.replace("<BUILDID>","(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]_[0-9][0-9]-[0-9][0-9]-[0-9][0-9]|[0-9]+)");
|
||||
line = line.replace("<JOBDIR>","<JENKINS_HOME>/jobs/.+");
|
||||
line = line.replace("<JENKINS_HOME>","\\Q"+Jenkins.getInstance().getRootDir().getPath()+"\\E");
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@ import java.io.StringWriter;
|
||||
|
||||
import jenkins.security.s2m.AdminWhitelistRule;
|
||||
import jenkins.security.s2m.DefaultFilePathFilter;
|
||||
import jenkins.security.s2m.MasterKillSwitchConfiguration;
|
||||
import org.jenkinsci.remoting.RoleChecker;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@@ -42,6 +41,7 @@ import org.junit.Rule;
|
||||
import org.jvnet.hudson.test.JenkinsRule;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import org.jvnet.hudson.test.Issue;
|
||||
|
||||
public class DefaultFilePathFilterTest {
|
||||
|
||||
@@ -111,4 +111,12 @@ public class DefaultFilePathFilterTest {
|
||||
throw new NoSuchMethodError(); // simulate legacy Callable impls
|
||||
}
|
||||
}
|
||||
|
||||
@Issue("JENKINS-27055")
|
||||
@Test public void matchBuildDir() throws Exception {
|
||||
File f = new File(r.buildAndAssertSuccess(r.createFreeStyleProject()).getRootDir(), "whatever");
|
||||
rule.setMasterKillSwitch(false);
|
||||
assertTrue(rule.checkFileAccess("write", f));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user