diff --git a/src/components/Icon/__tests__/utils.test.ts b/src/components/Icon/__tests__/utils.test.ts
new file mode 100644
index 0000000000..7c47bb92d5
--- /dev/null
+++ b/src/components/Icon/__tests__/utils.test.ts
@@ -0,0 +1,11 @@
+import {prepareStringData} from '../utils';
+
+describe('Icon utils', () => {
+ it('should remove width and height only inside svg tag', () => {
+ const data =
+ '';
+ expect(prepareStringData(data)).toEqual(
+ '',
+ );
+ });
+});
diff --git a/src/components/Icon/utils.ts b/src/components/Icon/utils.ts
index 7c4c4bb0ca..ce14fa4727 100644
--- a/src/components/Icon/utils.ts
+++ b/src/components/Icon/utils.ts
@@ -22,7 +22,12 @@ export function isStringSvgData(data: SVGIconData): data is SVGIconStringData {
return typeof data === 'string';
}
export function prepareStringData(data: SVGIconStringData) {
- return data.replace(/(width|height)=(["']?)\d+\2/g, '');
+ return data.replace(/