Atualização automática: 2026-05-18 18:53:18

This commit is contained in:
Hermes
2026-05-18 18:53:18 +00:00
parent 582977fc7a
commit 1972b016a8
+4 -6
View File
@@ -142,13 +142,11 @@ app.use((req, res, next) => {
try {
let jsContent = fs.readFileSync(filePath, 'utf8');
// Substitui chamadas diretas a window.location.pathname e location.pathname
jsContent = jsContent.replace(/window\.location\.pathname/g, '(window.__mockLocationPathname || window.location.pathname)');
jsContent = jsContent.replace(/location\.pathname/g, '(window.__mockLocationPathname || window.location.pathname)');
// Substitui chamadas diretas a window.location.pathname ou location.pathname em uma única passagem limpa
jsContent = jsContent.replace(/(?:window\.)?location\.pathname/g, '(window.__mockLocationPathname || window.location.pathname)');
// Substitui chamadas diretas a window.location.href e location.href
jsContent = jsContent.replace(/window\.location\.href/g, '(window.__mockLocationHref || window.location.href)');
jsContent = jsContent.replace(/location\.href/g, '(window.__mockLocationHref || window.location.href)');
// Substitui chamadas diretas a window.location.href ou location.href em uma única passagem limpa
jsContent = jsContent.replace(/(?:window\.)?location\.href/g, '(window.__mockLocationHref || window.location.href)');
res.setHeader('Content-Type', 'application/javascript');
return res.send(jsContent);