From 48da2d69c5a362d1856778a2bde96232c1589176 Mon Sep 17 00:00:00 2001 From: Jimmy Liu Date: Fri, 15 Jul 2022 16:13:01 -0700 Subject: [PATCH] Fix href in to not use absolute url --- packages/rrweb-snapshot/src/snapshot.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/rrweb-snapshot/src/snapshot.ts b/packages/rrweb-snapshot/src/snapshot.ts index 605d5d0565..1281e172cd 100644 --- a/packages/rrweb-snapshot/src/snapshot.ts +++ b/packages/rrweb-snapshot/src/snapshot.ts @@ -248,7 +248,8 @@ export function transformAttribute( value: string, ): string { // relative path in attribute - if (name === 'src' || (name === 'href' && value)) { + if (name === 'src' || (name === 'href' && value && !(tagName === 'use' && value[0] === '#'))) { + // href starts with a # is an id pointer for svg return absoluteToDoc(doc, value); } else if (name === 'xlink:href' && value && value[0] !== '#') { // xlink:href starts with # is an id pointer