From 8e871c17f84846043790d9e543fa5258fa3deffd Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 25 Jun 2021 17:27:09 +0200 Subject: [PATCH] Encode uri --- frontend/app/framework/angular/tab-router-link.directive.ts | 6 ++++-- frontend/app/shared/guards/content-must-exist.guard.ts | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/frontend/app/framework/angular/tab-router-link.directive.ts b/frontend/app/framework/angular/tab-router-link.directive.ts index 01e9913c6..e8fba074b 100644 --- a/frontend/app/framework/angular/tab-router-link.directive.ts +++ b/frontend/app/framework/angular/tab-router-link.directive.ts @@ -13,7 +13,7 @@ import { ActivatedRoute, Router } from '@angular/router'; }) export class TabRouterlinkDirective { @Input('sqxTabRouterLink') - public commands: any; + public commands: any[]; constructor( private readonly router: Router, @@ -23,7 +23,9 @@ export class TabRouterlinkDirective { @HostListener('click', ['$event']) public onClick(event: MouseEvent) { - const urlTree = this.router.createUrlTree(this.commands, { + const escaped = this.commands.map(x => encodeURIComponent(x)); + + const urlTree = this.router.createUrlTree(escaped, { relativeTo: this.route, }); diff --git a/frontend/app/shared/guards/content-must-exist.guard.ts b/frontend/app/shared/guards/content-must-exist.guard.ts index cec896726..5758b1e27 100644 --- a/frontend/app/shared/guards/content-must-exist.guard.ts +++ b/frontend/app/shared/guards/content-must-exist.guard.ts @@ -27,8 +27,10 @@ export class ContentMustExistGuard implements CanActivate { return this.contentsState.select(null).pipe(map(u => u === null)); } + const decoded = decodeURIComponent(contentId); + const result = - this.contentsState.select(contentId).pipe( + this.contentsState.select(decoded).pipe( tap(content => { if (!content) { this.router.navigate(['/404']);