File tree 2 files changed +30
-3
lines changed
2 files changed +30
-3
lines changed Original file line number Diff line number Diff line change @@ -582,15 +582,15 @@ export class MarkdownProcessor extends BaseProcessor {
582
582
return null ;
583
583
}
584
584
585
- const regex = / g i t h u b \. c o m \/ ( [ ^ / ] + ) \/ ( [ ^ / ] + ) ( \/ | $ ) / ;
585
+ const regex = / g i t h u b ( \. c o m \/ | : ) ( [ ^ / ] + ) \/ ( [ ^ / ] + ) ( \/ | $ ) / ;
586
586
const match = regex . exec ( repository ) ;
587
587
588
588
if ( ! match ) {
589
589
return null ;
590
590
}
591
591
592
- const account = match [ 1 ] ;
593
- const repositoryName = match [ 2 ] . replace ( / \. g i t $ / i, '' ) ;
592
+ const account = match [ 2 ] ;
593
+ const repositoryName = match [ 3 ] . replace ( / \. g i t $ / i, '' ) ;
594
594
const branchName = githubBranch ? githubBranch : 'HEAD' ;
595
595
596
596
return {
Original file line number Diff line number Diff line change @@ -1930,6 +1930,33 @@ describe('MarkdownProcessor', () => {
1930
1930
} ) ;
1931
1931
} ) ;
1932
1932
1933
+ it ( 'should infer baseContentUrl if its a github repo (short format)' , ( ) => {
1934
+ const manifest = {
1935
+ name : 'test' ,
1936
+ publisher : 'mocha' ,
1937
+ version : '0.0.1' ,
1938
+ description : 'test extension' ,
1939
+ engines : Object . create ( null ) ,
1940
+ repository : 'github:username/repository' ,
1941
+ } ;
1942
+
1943
+ const root = fixture ( 'readme' ) ;
1944
+ const processor = new ReadmeProcessor ( manifest , { } ) ;
1945
+ const readme = {
1946
+ path : 'extension/readme.md' ,
1947
+ localPath : path . join ( root , 'readme.md' ) ,
1948
+ } ;
1949
+
1950
+ return processor
1951
+ . onFile ( readme )
1952
+ . then ( file => read ( file ) )
1953
+ . then ( actual => {
1954
+ return readFile ( path . join ( root , 'readme.default.md' ) , 'utf8' ) . then ( expected => {
1955
+ assert . equal ( actual , expected ) ;
1956
+ } ) ;
1957
+ } ) ;
1958
+ } ) ;
1959
+
1933
1960
it ( 'should replace img urls with baseImagesUrl' , ( ) => {
1934
1961
const manifest = {
1935
1962
name : 'test' ,
You can’t perform that action at this time.
0 commit comments