From fbb79b2d677302b2f9858184cbe190b27c47cb51 Mon Sep 17 00:00:00 2001 From: trikunai Date: Fri, 7 Nov 2025 12:48:59 +0000 Subject: [PATCH] feat: authentication app_url links fix --- src/components/AppUrl.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/components/AppUrl.js b/src/components/AppUrl.js index ec940b5..0da7d39 100644 --- a/src/components/AppUrl.js +++ b/src/components/AppUrl.js @@ -12,8 +12,21 @@ const AppUrl = ({path = '', children}) => { const { siteConfig: {customFields}, } = useDocusaurusContext(); - const appUrl = customFields.appUrl || 'APP_URL'; - const fullUrl = path ? `${appUrl}${path}` : appUrl; + const appUrl = customFields.appUrl; + + if (!appUrl) { + console.error('APP_URL is not set in environment variables'); + return APP_URL; + } + + // Ensure the URL is absolute (starts with http:// or https://) + const baseUrl = appUrl.startsWith('http://') || appUrl.startsWith('https://') + ? appUrl + : `https://${appUrl}`; + + // Remove trailing slash from baseUrl if present, then add path + const cleanBaseUrl = baseUrl.replace(/\/$/, ''); + const fullUrl = path ? `${cleanBaseUrl}${path}` : cleanBaseUrl; const linkText = children || fullUrl; return (