@@ -53,8 +53,8 @@ public class GitHubService {
53
53
private final CommitService commitService ;
54
54
55
55
// 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 );
58
58
59
59
@ Autowired
60
60
public GitHubService (@ Value ("${githubAPI.authentication}" ) String authSetting ,
@@ -72,12 +72,12 @@ public GitHubService(@Value("${githubAPI.authentication}") String authSetting,
72
72
}
73
73
74
74
/**
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
77
77
* @return A list with the groups of the regex match, [owner, repo, branch, path]
78
78
*/
79
- public GithubDetails detailsFromCwlURL (String url ) {
80
- Matcher m = githubCwlPattern .matcher (url );
79
+ public GithubDetails detailsFromURL (String url ) {
80
+ Matcher m = githubUrlPattern .matcher (url );
81
81
if (m .find ()) {
82
82
return new GithubDetails (m .group (1 ), m .group (2 ), m .group (3 ), m .group (4 ));
83
83
}
0 commit comments