Spaces:
Runtime error

Brozy123 commited on
Commit
f4649f3
·
verified ·
1 Parent(s): 91d2440

Update network_fix.js

Browse files
Files changed (1) hide show
  1. network_fix.js +2 -1
network_fix.js CHANGED
@@ -48,7 +48,8 @@ function applyAdvancedFixes() {
48
  globalObj.fetch = async function(input, init) {
49
  let urlStr = typeof input === 'string' ? input : (input.url || input.toString());
50
  if (urlStr.includes('discord')) {
51
- urlStr = urlStr.replace(/discord\.com|discordapp\.com|dis\.gd|discord\.gg/, target_domain);
 
52
  }
53
  let newInit = { ...(init || {}) };
54
  if (!newInit.headers) newInit.headers = {};
 
48
  globalObj.fetch = async function(input, init) {
49
  let urlStr = typeof input === 'string' ? input : (input.url || input.toString());
50
  if (urlStr.includes('discord')) {
51
+ // Use a more precise regex to only replace the domain part
52
+ urlStr = urlStr.replace(/\b(discord\.com|discordapp\.com|ptb\.discord\.com|canary\.discord\.com|dis\.gd|discord\.gg)\b/, target_domain);
53
  }
54
  let newInit = { ...(init || {}) };
55
  if (!newInit.headers) newInit.headers = {};