@@ -6,7 +6,7 @@ type Transformer = (tagName: string, attribs: Attributes) => Tag;
66
77export type SanitizeImgHandling = 'IMG-DEL' | 'IMG-KEEP' | 'IMG-TO-LINK' ;
88
9- declare const dereq_html_sanitize : ( dirty : string , opts ?: {
9+ declare const dereq_sanitize_html : ( dirty : string , opts ?: {
1010 allowedTags ?: string [ ] ,
1111 selfClosing ?: string [ ] ,
1212 exclusiveFilter ?: ( frame : { tag : string , attribs : Attributes , text : string , tagPosition : number } ) => boolean ,
@@ -47,7 +47,7 @@ export class Xss {
4747 public static htmlSanitizeKeepBasicTags = ( dirtyHtml : string , imgToLink ?: SanitizeImgHandling ) : string => {
4848 const imgContentReplaceable = `IMG_ICON_${ Str . sloppyRandom ( ) } ` ;
4949 let remoteContentReplacedWithLink = false ;
50- let cleanHtml = dereq_html_sanitize ( dirtyHtml , {
50+ let cleanHtml = dereq_sanitize_html ( dirtyHtml , {
5151 allowedTags : Xss . ALLOWED_BASIC_TAGS ,
5252 allowedAttributes : Xss . ALLOWED_ATTRS ,
5353 allowedSchemes : Xss . ALLOWED_SCHEMES ,
@@ -85,7 +85,7 @@ export class Xss {
8585 if ( remoteContentReplacedWithLink ) {
8686 cleanHtml = `<font size="-1" color="#31a217" face="monospace">[remote content blocked for your privacy]</font><br /><br />${ cleanHtml } ` ;
8787 // clean it one more time in case something bad slipped in
88- cleanHtml = dereq_html_sanitize ( cleanHtml , { allowedTags : Xss . ALLOWED_BASIC_TAGS , allowedAttributes : Xss . ALLOWED_ATTRS , allowedSchemes : Xss . ALLOWED_SCHEMES } ) ;
88+ cleanHtml = dereq_sanitize_html ( cleanHtml , { allowedTags : Xss . ALLOWED_BASIC_TAGS , allowedAttributes : Xss . ALLOWED_ATTRS , allowedSchemes : Xss . ALLOWED_SCHEMES } ) ;
8989 }
9090 cleanHtml = cleanHtml . replace ( new RegExp ( imgContentReplaceable , 'g' ) , `<font color="#D14836" face="monospace">[img]</font>` ) ;
9191 return cleanHtml ;
@@ -106,7 +106,7 @@ export class Xss {
106106 let text = html . split ( br ) . join ( '\n' ) . split ( blockStart ) . filter ( v => ! ! v ) . join ( '\n' ) . split ( blockEnd ) . filter ( v => ! ! v ) . join ( '\n' ) ;
107107 text = text . replace ( / \n { 2 , } / g, '\n\n' ) ;
108108 // not all tags were removed above. Remove all remaining tags
109- text = dereq_html_sanitize ( text , {
109+ text = dereq_sanitize_html ( text , {
110110 allowedTags : [ 'img' , 'span' ] ,
111111 allowedAttributes : { img : [ 'src' ] } ,
112112 allowedSchemes : Xss . ALLOWED_SCHEMES ,
@@ -116,7 +116,7 @@ export class Xss {
116116 } ,
117117 }
118118 } ) ;
119- text = dereq_html_sanitize ( text , { allowedTags : [ ] } ) ; // clean it one more time to replace leftover spans with their text
119+ text = dereq_sanitize_html ( text , { allowedTags : [ ] } ) ; // clean it one more time to replace leftover spans with their text
120120 text = text . trim ( ) ;
121121 if ( outputNl !== '\n' ) {
122122 text = text . replace ( / \n / g, outputNl ) ;
0 commit comments