File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed
nbviewer/providers/github Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -388,17 +388,27 @@ def uri_rewrites(rewrites=[]):
388
388
]
389
389
# github enterprise
390
390
if os .environ .get ('GITHUB_API_URL' , '' ) != '' :
391
- github_api_url = os .environ .get ('GITHUB_API_URL' )
391
+ github_url = os .environ .get ('GITHUB_API_URL' ). split ( 'api/v3' )[ 0 ]
392
392
393
393
github_rewrites .extend ([
394
394
# raw view
395
- (r'^' + github_api_url . split ( '/api/v3/' )[ 0 ]
396
- + '/ ([^\/]+)/([^\/]+)/raw/([^\/]+)/(.*)' ,
395
+ (r'^' + github_url
396
+ + r' ([^\/]+)/([^\/]+)/raw/([^\/]+)/(.*)' ,
397
397
u'/github/{0}/{1}/blob/{2}/{3}' ),
398
398
399
399
# trees & blobs
400
- (r'^' + github_api_url . split ( '/api/v3/' )[ 0 ]
401
- + '/ ([\w\-]+)/([^\/]+)/(blob|tree)/(.*)$' ,
400
+ (r'^' + github_url
401
+ + r' ([\w\-]+)/([^\/]+)/(blob|tree)/(.*)$' ,
402
402
u'/github/{0}/{1}/{2}/{3}' ),
403
+
404
+ # user/repo
405
+ (r'^' + github_url
406
+ + r'([\w\-]+)/([^\/]+)/?$' ,
407
+ u'/github/{0}/{1}/tree/master' ),
408
+
409
+ # user
410
+ (r'^' + github_url
411
+ + r'([\w\-]+)$' ,
412
+ u'/github/{0}/' ),
403
413
])
404
414
return rewrites + github_rewrites
You can’t perform that action at this time.
0 commit comments