Skip to content

Commit

Permalink
Make parseVCSUri less brittle
Browse files Browse the repository at this point in the history
Fixes quarkusio#40369

(cherry picked from commit a80a37e)
  • Loading branch information
gsmet committed May 14, 2024
1 parent 1bd39d1 commit d54eb0d
Showing 1 changed file with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1194,9 +1194,19 @@ private static List<PolicyRule> toPolicyRulesList(Map<String, PolicyRuleConfig>
}

private static String parseVCSUri(VCSUriConfig config, ScmInfo scm) {
if (config.enabled) {
return config.override.orElseGet(() -> scm != null ? Git.sanitizeRemoteUrl(scm.getRemote().get("origin")) : null);
if (!config.enabled) {
return null;
}
return null;
if (config.override.isPresent()) {
return config.override.get();
}
if (scm == null) {
return null;
}
String originRemote = scm.getRemote().get("origin");
if (originRemote == null || originRemote.isBlank()) {
return null;
}
return Git.sanitizeRemoteUrl(originRemote);
}
}

0 comments on commit d54eb0d

Please sign in to comment.