[Fleet] Fix image in readme for installed integration (#188476)

This commit is contained in:
Nicolas Chaulet 2024-07-16 17:47:51 -04:00 committed by GitHub
parent f02a41c373
commit 601e42ee02
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4 additions and 2 deletions

View file

@ -43,7 +43,8 @@ export function useLinks() {
version: string;
}) => {
const imagePath = removeRelativePath(path);
const filePath = `${epmRouteService.getInfoPath(packageName, version)}/${imagePath}`;
const filePath = `${epmRouteService.getInfoPath(packageName, version)}${imagePath}`;
return http.basePath.prepend(filePath);
},
};

View file

@ -35,6 +35,6 @@ describe('Readme', () => {
const img = result.getByAltText('Image');
expect(img).toHaveStyle('max-width: 100%');
expect(img).toHaveAttribute('src', '/mock/api/fleet/epm/packages/test/1.0.0//img/image.png');
expect(img).toHaveAttribute('src', '/mock/api/fleet/epm/packages/test/1.0.0/img/image.png');
});
});

View file

@ -31,6 +31,7 @@ export function Readme({
(uri: string) => {
const isRelative =
uri.indexOf('http://') === 0 || uri.indexOf('https://') === 0 ? false : true;
const fullUri = isRelative ? toRelativeImage({ packageName, version, path: uri }) : uri;
return fullUri;
},