Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Fix replaceUrls

Jakub Novak64b9c2a4a09c
diff --git a/apps/reverse-proxy/utils/replaceUrls.ts b/apps/reverse-proxy/utils/replaceUrls.ts
index f65a7efbe..4eeecfe8c 100644
--- a/apps/reverse-proxy/utils/replaceUrls.ts
+++ b/apps/reverse-proxy/utils/replaceUrls.ts
@@ -1,9 +1,9 @@
export function replaceUrls(text: string, urlPathName: string, prefix?: string, lastChar: string = ''): string {
- const pattern = lastChar ? `${prefix}https://e2b-[^${lastChar}]*${lastChar}` : `${prefix}https://e2b-.*[^/]$`
+ const pattern = lastChar ? `(?<url>${prefix}https://e2b-[^${lastChar}]*)/${lastChar}` : `(?<url>${prefix}https://e2b-.*)/`
return text.replaceAll(
new RegExp(pattern, 'g'),
- match => match.replace(new RegExp(`/${lastChar}$`), lastChar),
+ (_, url) => url + lastChar,
)
.replaceAll(
`${prefix}https://e2b-landing-page.framer.website`,