From cb68263cae07d21526271158b69786ec17f3c3d6 Mon Sep 17 00:00:00 2001 From: Eoghan Murray Date: Fri, 3 May 2024 12:20:20 +0100 Subject: [PATCH] Fix that blob urls persist on the shared anchor element and can't be later modified (#1467) * Fix that blob urls persist on the shared anchor element and can't be later modified * Create nervous-kiwis-nail.md --- .changeset/nervous-kiwis-nail.md | 6 ++++++ packages/rrweb-snapshot/src/snapshot.ts | 2 ++ 2 files changed, 8 insertions(+) create mode 100644 .changeset/nervous-kiwis-nail.md diff --git a/.changeset/nervous-kiwis-nail.md b/.changeset/nervous-kiwis-nail.md new file mode 100644 index 0000000000..897df7ed5f --- /dev/null +++ b/.changeset/nervous-kiwis-nail.md @@ -0,0 +1,6 @@ +--- +'rrweb-snapshot': patch +'rrweb': patch +--- + +Bugfix after #1434 perf improvements: fix that blob urls persist on the shared anchor element and can't be later modified diff --git a/packages/rrweb-snapshot/src/snapshot.ts b/packages/rrweb-snapshot/src/snapshot.ts index 822fa04967..81dc2133a0 100644 --- a/packages/rrweb-snapshot/src/snapshot.ts +++ b/packages/rrweb-snapshot/src/snapshot.ts @@ -218,6 +218,8 @@ function getHref(doc: Document, customHref?: string) { } if (!customHref) { customHref = ''; + } else if (customHref.startsWith('blob:') || customHref.startsWith('data:')) { + return customHref; } // note: using `new URL` is slower. See #1434 or https://jsbench.me/uqlud17rxo/1 a.setAttribute('href', customHref);