Skip to content

Commit

Permalink
Strip more known bad characters before parsing
Browse files Browse the repository at this point in the history
Removes all the non-printable characters excluded from the XML
[characters specification][1].

[1]: https://www.w3.org/TR/xml/#charsets
  • Loading branch information
gshutler committed Dec 5, 2016
1 parent 6d17df3 commit f8e0aa6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/ews/soap/parsers/ews_parser.rb
Expand Up @@ -28,7 +28,7 @@ def initialize(soap_resp)

def parse(opts = {})
opts[:response_class] ||= EwsSoapResponse
@soap_resp.gsub!(//, '')
@soap_resp.gsub!(/&#x([0-8bcef]|1[0-9a-f]);/i, '')
sax_parser.parse(@soap_resp)
opts[:response_class].new @sax_doc.struct
end
Expand Down
2 changes: 1 addition & 1 deletion spec/soap_data/dodgy_ews_response.xml
Expand Up @@ -15,7 +15,7 @@
<t:ItemClass>IPM.Appointment</t:ItemClass>
<t:Subject>Invalid character</t:Subject>
<t:Sensitivity>Normal</t:Sensitivity>
<t:Body BodyType="Text"> Invalid character: &#x1A;</t:Body>
<t:Body BodyType="Text">Invalid characters: &#x0; &#x1; &#x2; &#x3; &#x4; &#x5; &#x6; &#x7; &#x8; &#xb; &#xc; &#xe; &#xf; &#x10; &#x11; &#x12; &#x13; &#x14; &#x15; &#x16; &#x17; &#x18; &#x19; &#x1A; &#x1B; &#x1C; &#x1D; &#x1E; &#x1F; </t:Body>
<t:DateTimeReceived>2016-01-01T00:00:00Z</t:DateTimeReceived>
<t:Size>42</t:Size>
<t:Importance>Normal</t:Importance>
Expand Down

0 comments on commit f8e0aa6

Please sign in to comment.