Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ampersand (&) handling in user data #9

Open
rahul-desai3 opened this issue Jun 25, 2019 · 2 comments
Open

Ampersand (&) handling in user data #9

rahul-desai3 opened this issue Jun 25, 2019 · 2 comments

Comments

@rahul-desai3
Copy link

If I am sanitizing user text input &XYZ&, it gets converted to &XYZ&.

Any pointers on how to fix this?

@mominrazashahid
Copy link

mominrazashahid commented Jan 26, 2023

I am also facing issue string contain > which converted to > any solution or I can de sanitize on front end ? I don't want to remove sanisation.

@mominrazashahid
Copy link

I fixed this in angular by using Angular sanitize pipe.

import { Pipe, PipeTransform } from '@angular/core';
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';

@Pipe({ name: 'sanitizeHtml' })
export class SanitizeHtmlPipe implements PipeTransform {

  constructor(private _sanitizer: DomSanitizer) { }

  transform(value: string): SafeHtml {
    return this._sanitizer.bypassSecurityTrustHtml(value);
  }

}

in .html file

<span [innerHTML]="specialist | sanitizeHtml"></span>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants