From 366632741cd76c457fa67c95a886b789e42a67b9 Mon Sep 17 00:00:00 2001 From: cruizba Date: Thu, 5 Feb 2026 19:39:48 +0100 Subject: [PATCH] fix: strip basePath prefix in redirectTo method Strip basePath prefix if present, since Angular router operates relative to --- .../src/lib/shared/services/navigation.service.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/meet-ce/frontend/projects/shared-meet-components/src/lib/shared/services/navigation.service.ts b/meet-ce/frontend/projects/shared-meet-components/src/lib/shared/services/navigation.service.ts index 8e60bf76..7afee202 100644 --- a/meet-ce/frontend/projects/shared-meet-components/src/lib/shared/services/navigation.service.ts +++ b/meet-ce/frontend/projects/shared-meet-components/src/lib/shared/services/navigation.service.ts @@ -1,6 +1,7 @@ import { Injectable } from '@angular/core'; import { Params, Router, UrlTree } from '@angular/router'; import { NavigationErrorReason } from '../models/navigation.model'; +import { AppConfigService } from './app-config.service'; import { AppDataService } from './app-data.service'; import { SessionStorageService } from './session-storage.service'; @@ -13,7 +14,8 @@ export class NavigationService { constructor( private router: Router, private sessionStorageService: SessionStorageService, - private appDataService: AppDataService + private appDataService: AppDataService, + private appConfigService: AppConfigService ) {} setLeaveRedirectUrl(leaveRedirectUrl: string): void { @@ -80,6 +82,13 @@ export class NavigationService { */ async redirectTo(url: string): Promise { try { + // Strip basePath prefix if present, since Angular router operates relative to + const basePath = this.appConfigService.basePath; + const basePathPrefix = basePath.endsWith('/') ? basePath.slice(0, -1) : basePath; + if (basePathPrefix && url.startsWith(basePathPrefix)) { + url = url.slice(basePathPrefix.length) || '/'; + } + let urlTree = this.router.parseUrl(url); await this.router.navigateByUrl(urlTree, { replaceUrl: true }); } catch (error) {