[PM-13202][Defect] MSP name with an apostrophe displaying dummy character in Delete provider screen (#11488)

* Resolve the msp name with apostrophe

* qParams.name exists and is a string before sanitization
This commit is contained in:
cyprain-okeke 2024-12-03 13:46:17 +01:00 committed by GitHub
parent 19663d9587
commit 194aa94302
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 2 deletions

View File

@ -1,4 +1,5 @@
import { Component, OnInit } from "@angular/core";
import { Component, OnInit, SecurityContext } from "@angular/core";
import { DomSanitizer } from "@angular/platform-browser";
import { ActivatedRoute, Router } from "@angular/router";
import { firstValueFrom } from "rxjs";
@ -24,6 +25,7 @@ export class VerifyRecoverDeleteProviderComponent implements OnInit {
private i18nService: I18nService,
private route: ActivatedRoute,
private toastService: ToastService,
private sanitizer: DomSanitizer,
) {}
async ngOnInit() {
@ -31,7 +33,10 @@ export class VerifyRecoverDeleteProviderComponent implements OnInit {
if (qParams.providerId != null && qParams.token != null && qParams.name != null) {
this.providerId = qParams.providerId;
this.token = qParams.token;
this.name = qParams.name;
this.name =
qParams.name && typeof qParams.name === "string"
? this.sanitizer.sanitize(SecurityContext.HTML, qParams.name) || ""
: "";
} else {
await this.router.navigate(["/"]);
}