Skip to content
Permalink
Browse files

[JENKINS-41124] Forgot to escape the escape character itself (and for…

…got some files too)
  • Loading branch information...
stephenc committed Jan 18, 2017
1 parent 1d254fa commit 15561c5e7406c49d3b269f34a0426b146e757fef
@@ -205,7 +205,7 @@ public MultiBranchProjectFactoryDescriptor getDescriptor() {
* @param source a repository
* @return criteria for treating its branches as a match
*/
@NonNull
@CheckForNull
protected abstract SCMSourceCriteria getSCMSourceCriteria(@NonNull SCMSource source);

/**
@@ -91,18 +91,21 @@ public static String encode(String name) {
In other words "/" / "?" / "#" / "[" / "]" everything else is going to be encoded for us anyway.
Note for safety, we will also encode "\" as some browsers convert that to a "/" so we want it double encoded
on the browser url.
on the browser url. And finally we need to escape our escape character "%"
*/
switch (c) {
case '#':
buf.append("%23");
break;
case '%':
buf.append("%25");
break;
case '/':
buf.append("%2F");
break;
case '?':
buf.append("%3F");
break;
case '#':
buf.append("%23");
break;
buf.append("%3F");
break;
case '[':
buf.append("%5B");
break;
@@ -155,6 +158,9 @@ public static String decode(String name) {
case '3':
buf.append('#');
break;
case '5':
buf.append('%');
break;
case 'F':
buf.append('/');
break;
@@ -25,6 +25,7 @@

package integration.harness;

import edu.umd.cs.findbugs.annotations.CheckForNull;
import edu.umd.cs.findbugs.annotations.NonNull;
import hudson.Extension;
import hudson.model.ItemGroup;
@@ -46,7 +47,7 @@ public BasicMultiBranchProjectFactory(SCMSourceCriteria criteria) {
this.criteria = criteria;
}

@NonNull
@CheckForNull
@Override
protected SCMSourceCriteria getSCMSourceCriteria(@NonNull SCMSource source) {
return criteria;

0 comments on commit 15561c5

Please sign in to comment.
You can’t perform that action at this time.