From e547ce2e1fcd650f5b4e5a02a4a28a611cc41f74 Mon Sep 17 00:00:00 2001 From: Karl DeBisschop Date: Tue, 23 Jul 2024 10:58:44 -0400 Subject: [PATCH] Fix regex backtracking --- src/main/java/com/bioraft/rundeck/nexus/BranchOrVersion.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/bioraft/rundeck/nexus/BranchOrVersion.java b/src/main/java/com/bioraft/rundeck/nexus/BranchOrVersion.java index 86c37fe..6911bcb 100644 --- a/src/main/java/com/bioraft/rundeck/nexus/BranchOrVersion.java +++ b/src/main/java/com/bioraft/rundeck/nexus/BranchOrVersion.java @@ -96,7 +96,7 @@ public BranchOrVersion(String path) { * Anything else is considered to be a branch. */ public boolean isVersion() { - return versionOrBranch.matches(".*\\d+[.]\\d+.*"); + return versionOrBranch.matches("^(v|rc)?\\d+[.]\\d+.*"); } /** @@ -133,7 +133,7 @@ private String component(String path) { * string-valued. */ private String tag(String path) { - return path.replaceAll(".*/", ""); + return path.replaceAll("/?[^/]*/", ""); } }