diff --git a/web-interface/server.js b/web-interface/server.js index b26cf6f..355fafc 100644 --- a/web-interface/server.js +++ b/web-interface/server.js @@ -142,11 +142,17 @@ app.use((req, res, next) => { try { let jsContent = fs.readFileSync(filePath, 'utf8'); - // 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 window.location.pathname de forma segura + jsContent = jsContent.replace(/\bwindow\.location\.pathname\b/g, '(window.__mockLocationPathname || window.location.pathname)'); - // 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)'); + // Substitui location.pathname isolado (evita quebrar e.location.pathname ou history.location.pathname) + jsContent = jsContent.replace(/(?