Skip to content

Commit 38a5d84

Browse files
authored
🐛 Prevent SVG icons from leaking into DOM (#9574)
1 parent 0a3713a commit 38a5d84

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

airbyte-webapp/src/utils/imageUtils.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@ import styled from "styled-components";
33

44
import { DefaultLogoCatalog } from "components";
55

6-
const IconContainer = styled.div`
6+
const IconContainer = styled.img`
77
height: 100%;
8-
& > svg {
9-
height: 100%;
10-
width: 100%;
11-
}
8+
width: 100%;
129
`;
1310

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

27-
return <IconContainer dangerouslySetInnerHTML={{ __html: icon }} />;
24+
return (
25+
<IconContainer
26+
alt=""
27+
src={`data:image/svg+xml;utf8,${encodeURIComponent(icon)}`}
28+
/>
29+
);
2830
};

0 commit comments

Comments
 (0)