This repository was archived by the owner on Jan 7, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +26
-3
lines changed Expand file tree Collapse file tree 2 files changed +26
-3
lines changed Original file line number Diff line number Diff line change @@ -60,9 +60,10 @@ function endElement(name) {
60
60
currentObject [ '$t' ] = currentObject [ '$t' ] . trim ( )
61
61
}
62
62
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
+ //}
66
67
67
68
currentObject [ '$t' ] = coerce ( currentObject [ '$t' ] , name ) ;
68
69
}
Original file line number Diff line number Diff line change @@ -129,6 +129,28 @@ describe('xml2json', function () {
129
129
done ( ) ;
130
130
} ) ;
131
131
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
+
132
154
it ( 'throws error on bad options' , function ( done ) {
133
155
134
156
var throws = function ( ) {
You can’t perform that action at this time.
0 commit comments