From a0a68a194b496573e78dccb2ad1fdd843521049e Mon Sep 17 00:00:00 2001 From: Paul Irish Date: Wed, 1 Feb 2023 16:43:52 -0800 Subject: [PATCH] report: avoid really slow regexes for long urls --- shared/util.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shared/util.js b/shared/util.js index 6d096cbb0b89..0b1210441e49 100644 --- a/shared/util.js +++ b/shared/util.js @@ -188,6 +188,8 @@ class Util { const MAX_LENGTH = 64; if (parsedUrl.protocol !== 'data:') { + // Even non-data uris can be 10k characters long. + name = name.slice(0, 200); // Always elide hexadecimal hash name = name.replace(/([a-f0-9]{7})[a-f0-9]{13}[a-f0-9]*/g, `$1${ELLIPSIS}`); // Also elide other hash-like mixed-case strings