2323requirejs . config ( {
2424 baseUrl : '/bower_components' ,
2525 paths : {
26- 'jquery' : 'jquery/dist/jquery.min' ,
26+ 'jquery' : 'jquery/dist/jquery.min'
2727 }
2828} ) ;
2929
@@ -43,7 +43,7 @@ require(['jquery'],
4343 */
4444require ( [ 'jquery' ] ,
4545 function ( $ ) {
46- var generalPattern = "\\/([A-Za-z0-9_.-]+)\\/([A-Za-z0-9_.-]+)\\/?(?:tree|blob)\\/([^/]+)(?: \\/(.+\\.cwl)) $" ;
46+ var generalPattern = "\\/([A-Za-z0-9_.-]+)\\/([A-Za-z0-9_.-]+)\\/?(?:(?: tree|blob)\\/([^/]+)\\/?(.*)?)? $" ;
4747 var githubPattern = new RegExp ( "^https?:\\/\\/github\\.com" + generalPattern ) ;
4848 var gitlabPattern = new RegExp ( "^https?:\\/\\/gitlab\\.com" + generalPattern ) ;
4949 var gitPattern = new RegExp ( "^((git|ssh|http(s)?)|(git@[\\w\\.]+))(:(//)?)([\\w\\.@\\:/\\-~]+)(\\.git)(/)?$" ) ;
@@ -76,24 +76,25 @@ require(['jquery'],
7676 * Validate form before submit
7777 */
7878 $ ( '#add' ) . submit ( function ( ) {
79- var pathPattern = new RegExp ( "^\\/?([^\\/]*\\/)*[^\\/]+\\.cwl$" ) ;
8079 var input = $ ( "#url" ) . val ( ) ;
8180 if ( gitPattern . test ( input ) ) {
82- var success = true ;
83- if ( ! $ ( "#branch" ) . val ( ) ) {
84- addWarning ( "branch" , "You must provide a branch name for the workflow" ) ;
85- success = false ;
86- }
87- if ( ! $ ( "#path" ) . val ( ) ) {
88- addWarning ( "path" , "You must provide a path to the workflow" ) ;
89- success = false ;
90- } else if ( ! pathPattern . test ( $ ( "#path" ) . val ( ) ) ) {
91- addWarning ( "path" , "Must be a valid path from the root to a .cwl workflow" ) ;
92- success = false ;
81+ var success = false ;
82+ if ( input . startsWith ( "ssh" ) || input . startsWith ( "git@" ) ) {
83+ addWarning ( "url" , "SSH is not supported as a protocol, please provide a HTTPS URL to clone" ) ;
84+ } else {
85+ success = true ;
86+ if ( ! $ ( "#branch" ) . val ( ) ) {
87+ addWarning ( "branch" , "You must provide a branch name for the workflow" ) ;
88+ success = false ;
89+ }
90+ if ( ! $ ( "#path" ) . val ( ) ) {
91+ addWarning ( "path" , "You must provide a path to the workflow or a directory of workflows" ) ;
92+ success = false ;
93+ }
9394 }
9495 return success ;
9596 } else if ( ! githubPattern . test ( input ) && ! gitlabPattern . test ( input ) ) {
96- addWarning ( "url" , "Must be a URL to a workflow on Gitlab or Github, or a Git repository URL" ) ;
97+ addWarning ( "url" , "Must be a URL to a workflow or directory of workflows on Gitlab or Github, or a Git repository URL" ) ;
9798 return false ;
9899 }
99100 } ) ;
0 commit comments