File tree 1 file changed +11
-3
lines changed
player/service/plugins/routes/lib
1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -152,11 +152,19 @@ module.exports = {
152
152
} ,
153
153
154
154
/**
155
- * Checks the given XML content, returning false if the content
156
- * appears potentially malicious.
155
+ * Attempts to sanitize the given content, throwing an error if the provided
156
+ * content is neither a string nor a Buffer.
157
+ *
157
158
* @param {String|Buffer } xmlContent
158
159
*/
159
160
sanitizeXML : async ( xmlContent ) => {
160
- return xmlSanitizer ( xmlContent ) ;
161
+ if ( typeof xmlContent === "string" )
162
+ return xmlSanitizer ( xmlContent ) ;
163
+ else if ( Buffer . isBuffer ( xmlContent ) )
164
+ return xmlSanitizer ( xmlContent . toString ( ) ) ;
165
+ else
166
+ console . error ( "helpers.sanitizeXML requires either a string or a Buffer -- received: " + typeof xmlContent ) ;
167
+
168
+ return undefined ;
161
169
}
162
170
} ;
You can’t perform that action at this time.
0 commit comments