This repository was archived by the owner on Jan 7, 2021. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -60,9 +60,10 @@ function endElement(name) {
6060 currentObject [ '$t' ] = currentObject [ '$t' ] . trim ( )
6161 }
6262
63- if ( options . sanitize ) {
64- currentObject [ '$t' ] = sanitizer . sanitize ( currentObject [ '$t' ] , true ) ;
65- }
63+ // node-expat already reverse sanitizes it whether we like it or not
64+ //if (options.sanitize) {
65+ // currentObject['$t'] = sanitizer.sanitize(currentObject['$t'], true);
66+ //}
6667
6768 currentObject [ '$t' ] = coerce ( currentObject [ '$t' ] , name ) ;
6869 }
Original file line number Diff line number Diff line change @@ -129,6 +129,28 @@ describe('xml2json', function () {
129129 done ( ) ;
130130 } ) ;
131131
132+ it ( 'does doesnt double sanitize' , function ( done ) {
133+
134+ var json = internals . readFixture ( 'xmlsanitize3.json' ) ;
135+ var result = parser . toXml ( json , { sanitize : true } ) ;
136+ var xml = internals . readFixture ( 'xmlsanitize3.xml' ) ;
137+
138+ expect ( result ) . to . equal ( xml ) ;
139+
140+ done ( ) ;
141+ } ) ;
142+
143+ it ( 'does doesnt double unsanitize' , function ( done ) {
144+
145+ var xml = internals . readFixture ( 'xmlsanitize3.xml' ) ;
146+ var result = parser . toJson ( xml , { sanitize : true , reversible : true } ) ;
147+ var json = internals . readFixture ( 'xmlsanitize3.json' ) ;
148+
149+ expect ( result ) . to . equal ( json ) ;
150+
151+ done ( ) ;
152+ } ) ;
153+
132154 it ( 'throws error on bad options' , function ( done ) {
133155
134156 var throws = function ( ) {
You can’t perform that action at this time.
0 commit comments