From eb8db3215cc1b90f76836cb2b1d10dff8a4115c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E4=B8=96=E5=86=9B?= <30999793+AllForNothing@users.noreply.github.com> Date: Thu, 9 Dec 2021 10:15:21 +0800 Subject: [PATCH] Fix unescaped URL for repo links (#16092) Signed-off-by: AllForNothing --- .../base/project/repository/repository-gridview.component.ts | 4 ++-- .../list-repository-ro/list-repository-ro.component.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/portal/src/app/base/project/repository/repository-gridview.component.ts b/src/portal/src/app/base/project/repository/repository-gridview.component.ts index 7ffd3f362..7bcaa4c10 100644 --- a/src/portal/src/app/base/project/repository/repository-gridview.component.ts +++ b/src/portal/src/app/base/project/repository/repository-gridview.component.ts @@ -125,8 +125,8 @@ export class RepositoryGridviewComponent implements OnChanges, OnInit, OnDestroy return this.systemInfo && this.systemInfo.has_ca_root; } - getLink(repoEvt: NewRepository): string { - return `/harbor/projects/${repoEvt.project_id}/repositories/${repoEvt.name.substr(this.projectName.length + 1)}`; + getLink(repoEvt: NewRepository) { + return ['/harbor/projects', repoEvt.project_id, 'repositories', repoEvt.name.substr(this.projectName.length + 1)]; } ngOnChanges(changes: SimpleChanges): void { diff --git a/src/portal/src/app/shared/components/list-repository-ro/list-repository-ro.component.ts b/src/portal/src/app/shared/components/list-repository-ro/list-repository-ro.component.ts index 07c114b21..742beafef 100644 --- a/src/portal/src/app/shared/components/list-repository-ro/list-repository-ro.component.ts +++ b/src/portal/src/app/shared/components/list-repository-ro/list-repository-ro.component.ts @@ -36,7 +36,7 @@ export class ListRepositoryROComponent { getLink(projectId: number, repoName: string) { let projectName = repoName.split('/')[0]; let repositorieName = projectName ? repoName.substr(projectName.length + 1) : repoName; - return `/harbor/projects/${projectId}/repositories/${repositorieName}`; + return ['/harbor/projects', projectId, 'repositories', repositorieName]; } getQueryParams() { if (this.sessionService.getCurrentUser()) {