fix: Ignore PAT with emtpy SCM url

Signed-off-by: Anatolii Bazko <abazko@redhat.com>
pull/610/head
Anatolii Bazko 2023-11-16 10:45:36 +01:00
parent b5e1e2a4a2
commit 691982e5d8
1 changed files with 3 additions and 0 deletions

View File

@ -11,6 +11,8 @@
*/
package org.eclipse.che.api.factory.server.scm.kubernetes;
import static com.google.common.base.Strings.isNullOrEmpty;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableMap;
import io.fabric8.kubernetes.api.model.LabelSelector;
@ -186,6 +188,7 @@ public class KubernetesPersonalAccessTokenManager implements PersonalAccessToken
&& (oAuthProviderName == null
|| oAuthProviderName.equals(
annotations.get(ANNOTATION_SCM_PERSONAL_ACCESS_TOKEN_NAME)))
&& (!isNullOrEmpty(trimmedUrl)) // ignore PAT with empty server endpoint URL
&& (scmServerUrl == null
|| trimmedUrl.equals(StringUtils.trimEnd(scmServerUrl, '/')))) {
String token =