aboutsummaryrefslogtreecommitdiff
path: root/browser/GMPolyfill.js
diff options
context:
space:
mode:
authorVendicated <vendicated@riseup.net>2023-04-28 01:13:42 +0200
committerVendicated <vendicated@riseup.net>2023-04-28 01:13:42 +0200
commit5f5d4b896193a632d3bc6e16048ec92843e01c71 (patch)
tree2f9dae7c1434925d6da742d719a14dc9d154d3c8 /browser/GMPolyfill.js
parent5be86f9bd160edea9a525e5a3b249ba573284d33 (diff)
downloadVencord-5f5d4b896193a632d3bc6e16048ec92843e01c71.tar.gz
Vencord-5f5d4b896193a632d3bc6e16048ec92843e01c71.tar.bz2
Vencord-5f5d4b896193a632d3bc6e16048ec92843e01c71.zip
[skip ci] UserScript: Fix cors check pt 2
Diffstat (limited to 'browser/GMPolyfill.js')
-rw-r--r--browser/GMPolyfill.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/browser/GMPolyfill.js b/browser/GMPolyfill.js
index beee915..1f74a7c 100644
--- a/browser/GMPolyfill.js
+++ b/browser/GMPolyfill.js
@@ -59,7 +59,9 @@ async function checkCors(url, method) {
const origin = headers["access-control-allow-origin"];
if (origin !== "*" && origin !== window.location.origin) return false;
- const methods = headers["access-control-allow-methods"]?.toLowerCase().split(/,\s/g);
+ const methods = headers["access-control-allow-methods"]?.toLowerCase()
+ .split(",")
+ .map(s => s.trim());
if (methods && !methods.includes(method.toLowerCase())) return false;
return true;