parent
6b57852f5e
commit
1749c1c3c4
2 changed files with 32 additions and 1 deletions
|
@ -150,7 +150,9 @@ export class ReadmeProcessor extends BaseProcessor {
|
|||
const match = regex.exec(repository);
|
||||
|
||||
if (match) {
|
||||
return `https://github.com/${ match[1] }/${ match[2] }/raw/master`;
|
||||
const account = match[1];
|
||||
const repository = match[2].replace(/\.git$/i, '');
|
||||
return `https://github.com/${ account }/${ repository }/raw/master`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -398,4 +398,33 @@ describe('ReadmeProcessor', () => {
|
|||
})
|
||||
});
|
||||
});
|
||||
|
||||
it('should infer baseContentUri if its a github repo (.git)', () => {
|
||||
const manifest = {
|
||||
name: 'test',
|
||||
publisher: 'mocha',
|
||||
version: '0.0.1',
|
||||
description: 'test extension',
|
||||
engines: Object.create(null),
|
||||
repository: 'https://github.com/username/repository.git'
|
||||
};
|
||||
|
||||
const root = fixture('readme');
|
||||
const processor = new ReadmeProcessor(manifest);
|
||||
const readme = {
|
||||
path: 'extension/readme.md',
|
||||
localPath: path.join(root, 'readme.md')
|
||||
};
|
||||
|
||||
return processor.onFile(readme)
|
||||
.then(file => read(file))
|
||||
.then(actualBuffer => {
|
||||
const actual = actualBuffer.toString('utf8');
|
||||
|
||||
return readFile(path.join(root, 'readme.expected.md'), 'utf8')
|
||||
.then(expected => {
|
||||
assert.equal(actual, expected);
|
||||
})
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Add table
Reference in a new issue