@@ -30,6 +30,7 @@ function cmdGet (msg, done) {
30
30
var cache = opts . cache
31
31
var registry = opts . registry + msg . name
32
32
33
+ console . log ( 'Processing module: ' , msg . name )
33
34
cache . load$ ( msg . name , ( err , github ) => {
34
35
if ( err ) return done ( err )
35
36
@@ -51,19 +52,25 @@ function cmdGet (msg, done) {
51
52
var url = repository . url || ''
52
53
53
54
if ( url . length > 0 ) {
55
+ console . log ( 'Matching URL: ' , url )
54
56
var matches = / [ \/ : ] ( [ ^ \/ : ] + ?) [ \/ : ] ( [ ^ \/ ] + ?) ( \. g i t ) * $ / . exec ( url )
55
- var params = {
56
- name : msg . name ,
57
- url : url ,
58
- user : matches [ 1 ] || null ,
59
- repo : matches [ 2 ] || null
60
- }
61
57
62
- if ( ! params . user || ! params . repo ) {
63
- return done ( new Error ( 'not found on github' ) )
58
+ if ( matches && matches . length === 2 ) {
59
+ var params = {
60
+ name : msg . name ,
61
+ url : url ,
62
+ user : matches [ 1 ] || null ,
63
+ repo : matches [ 2 ] || null
64
+ }
65
+
66
+ if ( ! params . user || ! params . repo ) {
67
+ return done ( new Error ( 'not found on github' ) )
68
+ }
69
+
70
+ queryGithub ( params , done )
71
+ } else {
72
+ return done ( new Error ( 'invalid github url:' , url , ' for module:' , msg . name ) )
64
73
}
65
-
66
- queryGithub ( params , done )
67
74
}
68
75
else {
69
76
return done ( new Error ( 'not found on github' ) )
0 commit comments