Updated extractPartsFromAsset in azure-devops-utils to handle file paths that being with only ".".
Signed-off-by: Caden Wheeler <cawheeler@webstaurantstore.com>
This commit is contained in:
@@ -235,6 +235,15 @@ describe('extractPartsFromAsset', () => {
|
||||
ext: '.gif',
|
||||
});
|
||||
});
|
||||
|
||||
it('should return parts from asset with leading . without /', () => {
|
||||
const result = extractPartsFromAsset('[Image 1](.images/sample-1.PNG)');
|
||||
expect(result).toEqual({
|
||||
label: 'Image 1',
|
||||
path: '.images/sample-1',
|
||||
ext: '.PNG',
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('replaceReadme', () => {
|
||||
|
||||
@@ -325,7 +325,7 @@ export function extractPartsFromAsset(content: string): {
|
||||
return {
|
||||
ext,
|
||||
label,
|
||||
path: path.startsWith('.') ? path.substring(1, path.length) : path,
|
||||
path: path.startsWith('./') ? path.substring(1, path.length) : path,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user