@@ -53,8 +53,8 @@ public class GitHubService {
5353 private final CommitService commitService ;
5454
5555 // URL validation for directory links
56- private final String GITHUB_CWL_REGEX = "^https?:\\ /\\ /github\\ .com\\ /([A-Za-z0-9_.-]+)\\ /([A-Za-z0-9_.-]+)\\ /?(?:tree|blob)\\ /([^/]+)(?: \\ /(.+ \\ .cwl)) $" ;
57- private final Pattern githubCwlPattern = Pattern .compile (GITHUB_CWL_REGEX );
56+ private final String GITHUB_URL_REGEX = "^https?:\\ /\\ /github\\ .com\\ /([A-Za-z0-9_.-]+)\\ /([A-Za-z0-9_.-]+)\\ /?(?:(?: tree|blob)\\ /([^/]+)\\ /?(.*)?)? $" ;
57+ private final Pattern githubUrlPattern = Pattern .compile (GITHUB_URL_REGEX );
5858
5959 @ Autowired
6060 public GitHubService (@ Value ("${githubAPI.authentication}" ) String authSetting ,
@@ -72,12 +72,12 @@ public GitHubService(@Value("${githubAPI.authentication}") String authSetting,
7272 }
7373
7474 /**
75- * Extract the details of a Github cwl file URL using a regular expression
76- * @param url The Github URL to a cwl file
75+ * Extract the details of a Github URL using a regular expression
76+ * @param url The Github URL to a directory or file
7777 * @return A list with the groups of the regex match, [owner, repo, branch, path]
7878 */
79- public GithubDetails detailsFromCwlURL (String url ) {
80- Matcher m = githubCwlPattern .matcher (url );
79+ public GithubDetails detailsFromURL (String url ) {
80+ Matcher m = githubUrlPattern .matcher (url );
8181 if (m .find ()) {
8282 return new GithubDetails (m .group (1 ), m .group (2 ), m .group (3 ), m .group (4 ));
8383 }
0 commit comments