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 @@ -433,17 +433,27 @@ def uri_rewrites(rewrites=[]):
433
433
]
434
434
# github enterprise
435
435
if os .environ .get ('GITHUB_API_URL' , '' ) != '' :
436
- github_api_url = os .environ .get ('GITHUB_API_URL' )
436
+ github_base_url = os .environ .get ('GITHUB_API_URL' ). split ( 'api/v3' )[ 0 ]
437
437
438
438
github_rewrites .extend ([
439
439
# raw view
440
- (r'^' + github_api_url . split ( '/api/v3/' )[ 0 ]
441
- + '/ ([^\/]+)/([^\/]+)/raw/([^\/]+)/(.*)' ,
440
+ (r'^' + github_base_url
441
+ + r' ([^\/]+)/([^\/]+)/raw/([^\/]+)/(.*)' ,
442
442
u'/github/{0}/{1}/blob/{2}/{3}' ),
443
443
444
444
# trees & blobs
445
- (r'^' + github_api_url . split ( '/api/v3/' )[ 0 ]
446
- + '/ ([\w\-]+)/([^\/]+)/(blob|tree)/(.*)$' ,
445
+ (r'^' + github_base_url
446
+ + r' ([\w\-]+)/([^\/]+)/(blob|tree)/(.*)$' ,
447
447
u'/github/{0}/{1}/{2}/{3}' ),
448
+
449
+ # user/repo
450
+ (r'^' + github_base_url
451
+ + r'([\w\-]+)/([^\/]+)/?$' ,
452
+ u'/github/{0}/{1}/tree/master' ),
453
+
454
+ # user
455
+ (r'^' + github_base_url
456
+ + r'([\w\-]+)/?$' ,
457
+ u'/github/{0}/' ),
448
458
])
449
459
return rewrites + github_rewrites
You can’t perform that action at this time.
0 commit comments