use string instead of symbol for safety

This commit is contained in:
Vendicated 2025-02-16 22:16:39 +01:00
parent de2565a7ea
commit 610b09ccec
No known key found for this signature in database
GPG key ID: D66986BAF75ECF18

View file

@ -114,7 +114,7 @@ const TypedArray = Object.getPrototypeOf(Int8Array);
// Discord might export a Proxy that returns non-null values for any property key (e.g. their i18n Proxy) // Discord might export a Proxy that returns non-null values for any property key (e.g. their i18n Proxy)
// We can use a unique symbol to detect this and ignore it // We can use a unique symbol to detect this and ignore it
const uniqueSymbol = Symbol("matchesLiterallyAnything"); const uniqueName = "is this a proxy that returns values for any key?";
function _shouldIgnoreValue(value: any) { function _shouldIgnoreValue(value: any) {
if (value == null) return true; if (value == null) return true;
@ -135,14 +135,14 @@ export function _shouldIgnoreModule(exports: any) {
return false; return false;
} }
if (exports[uniqueSymbol]) { if (exports[uniqueName]) {
return true; return true;
} }
let allNonEnumerable = true; let allNonEnumerable = true;
for (const exportKey in exports) { for (const exportKey in exports) {
const exp = exports[exportKey]; const exp = exports[exportKey];
if (exp?.[uniqueSymbol]) { if (exp?.[uniqueName]) {
return true; return true;
} }