Skip to content

Commit

Permalink
🐛 Prevent SVG icons from leaking into DOM (#9574)
Browse files Browse the repository at this point in the history
  • Loading branch information
timroes authored Jan 19, 2022
1 parent 0a3713a commit 38a5d84
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions airbyte-webapp/src/utils/imageUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@ import styled from "styled-components";

import { DefaultLogoCatalog } from "components";

const IconContainer = styled.div`
const IconContainer = styled.img`
height: 100%;
& > svg {
height: 100%;
width: 100%;
}
width: 100%;
`;

const IconDefaultContainer = styled.div`
Expand All @@ -24,5 +21,10 @@ export const getIcon = (icon?: string): React.ReactNode => {
);
}

return <IconContainer dangerouslySetInnerHTML={{ __html: icon }} />;
return (
<IconContainer
alt=""
src={`data:image/svg+xml;utf8,${encodeURIComponent(icon)}`}
/>
);
};

0 comments on commit 38a5d84

Please sign in to comment.