diff --git a/apps/web/lib/plain/plainChat.tsx b/apps/web/lib/plain/plainChat.tsx index b4e7a95f848130..817430f84d32e4 100644 --- a/apps/web/lib/plain/plainChat.tsx +++ b/apps/web/lib/plain/plainChat.tsx @@ -80,10 +80,12 @@ const PlainChat = () => { const isAppDomain = useMemo(() => { const restrictedPaths = process.env.NEXT_PUBLIC_PLAIN_CHAT_EXCLUDED_PATHS?.split(",") || []; + const pathSegments = pathname?.split("/").filter(Boolean) || []; + return ( typeof window !== "undefined" && window.location.origin === process.env.NEXT_PUBLIC_WEBAPP_URL && - !restrictedPaths.some((path) => pathname?.includes(path.trim())) + !restrictedPaths.some((path) => pathSegments.some((segment) => segment.startsWith(path.trim()))) ); }, [pathname]);