File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed
main/java/org/jenkinsci/plugins/github_branch_source
test/java/org/jenkinsci/plugins/github_branch_source Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change 2727import java .time .Instant ;
2828import java .util .HashMap ;
2929import java .util .List ;
30+ import java .util .Locale ;
3031import java .util .Map ;
3132import java .util .concurrent .TimeUnit ;
3233import java .util .logging .Level ;
@@ -231,14 +232,21 @@ static AppInstallationToken generateAppInstallationToken(
231232 if (appInstallations .size () == 1 ) {
232233 appInstallation = appInstallations .get (0 );
233234 } else {
235+ final String ownerOrEmpty = owner != null ? owner : "" ;
234236 appInstallation =
235237 appInstallations .stream ()
236- .filter (installation -> installation .getAccount ().getLogin ().equals (owner ))
238+ .filter (
239+ installation ->
240+ installation
241+ .getAccount ()
242+ .getLogin ()
243+ .toLowerCase (Locale .ROOT )
244+ .equals (ownerOrEmpty .toLowerCase (Locale .ROOT )))
237245 .findAny ()
238246 .orElseThrow (
239247 () ->
240248 new IllegalArgumentException (
241- String .format (ERROR_NO_OWNER_MATCHING , appId , owner )));
249+ String .format (ERROR_NO_OWNER_MATCHING , appId , ownerOrEmpty )));
242250 }
243251
244252 GHAppInstallationToken appInstallationToken =
Original file line number Diff line number Diff line change @@ -100,7 +100,7 @@ public static void setUpJenkins() throws Exception {
100100 "sample" ,
101101 "54321" ,
102102 Secret .fromString (PKCS8_PRIVATE_KEY ));
103- appCredentials .setOwner ("cloudbeers " );
103+ appCredentials .setOwner ("cloudBeers " );
104104 store .addCredentials (Domain .global (), appCredentials );
105105 appCredentialsNoOwner =
106106 new GitHubAppCredentials (
@@ -536,7 +536,7 @@ public void testPassword() throws Exception {
536536 // ok
537537 assertEquals (
538538 e .getMessage (),
539- "Found multiple installations for GitHub app ID 54321 but none match credential owner \" null \" . "
539+ "Found multiple installations for GitHub app ID 54321 but none match credential owner \" \" . "
540540 + "Set the right owner in the credential advanced options" );
541541 }
542542
You can’t perform that action at this time.
0 commit comments