Browse Source

Encode uri

pull/732/head
Sebastian 5 years ago
parent
commit
8e871c17f8
  1. 6
      frontend/app/framework/angular/tab-router-link.directive.ts
  2. 4
      frontend/app/shared/guards/content-must-exist.guard.ts

6
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,
});

4
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']);

Loading…
Cancel
Save