From b1a338681b4f79ed43610b35cbc8132243cf5894 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Tue, 26 Oct 2021 08:55:05 -0400 Subject: [PATCH] Shield against possible case of invalid attribute name Not sure this can really happen, but if ever Math.random() would return `0.9999999999999999`, the attribute name would start with `{`, i.e. an invalid attribute name. --- platform/common/vapi-client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/common/vapi-client.js b/platform/common/vapi-client.js index 3a3f691e4..b87eca0d5 100644 --- a/platform/common/vapi-client.js +++ b/platform/common/vapi-client.js @@ -40,7 +40,7 @@ if ( vAPI.randomToken = function() { const n = Math.random(); - return String.fromCharCode(n * 26 + 97) + + return String.fromCharCode(n * 25 + 97) + Math.floor( (0.25 + n * 0.75) * Number.MAX_SAFE_INTEGER ).toString(36).slice(-8);