Skip to content

armgit / E2B

Public Imported from GitHub
0

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

Fix replace urls

Jakub Novak3734e0847e8c
diff --git a/apps/reverse-proxy/utils/replaceUrls.ts b/apps/reverse-proxy/utils/replaceUrls.ts
index 20c3c9bed..f65a7efbe 100644
--- a/apps/reverse-proxy/utils/replaceUrls.ts
+++ b/apps/reverse-proxy/utils/replaceUrls.ts
@@ -1,6 +1,8 @@
-export function replaceUrls(text: string, urlPathName: string, prefix: string, lastChar: string): string {
+export function replaceUrls(text: string, urlPathName: string, prefix?: string, lastChar: string = ''): string {
+ const pattern = lastChar ? `${prefix}https://e2b-[^${lastChar}]*${lastChar}` : `${prefix}https://e2b-.*[^/]$`
+
return text.replaceAll(
- new RegExp(`${prefix}https://e2b-[^${lastChar}]*${lastChar}`, 'g'),
+ new RegExp(pattern, 'g'),
match => match.replace(new RegExp(`/${lastChar}$`), lastChar),
)
.replaceAll(