Skip to content

Commit

Permalink
Fix regex backtracking
Browse files Browse the repository at this point in the history
  • Loading branch information
Karl DeBisschop committed Jul 23, 2024
1 parent 5e71bfb commit e547ce2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/com/bioraft/rundeck/nexus/BranchOrVersion.java
Original file line number Diff line number Diff line change
Expand Up @@ -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+.*");
}

/**
Expand Down Expand Up @@ -133,7 +133,7 @@ private String component(String path) {
* string-valued.
*/
private String tag(String path) {
return path.replaceAll(".*/", "");
return path.replaceAll("/?[^/]*/", "");
}

}

0 comments on commit e547ce2

Please sign in to comment.