diff --git a/response.go b/response.go index 7d27665..a510556 100644 --- a/response.go +++ b/response.go @@ -54,7 +54,7 @@ func (or *Response) readSGMLHeaders(r *bufio.Reader) error { // optionally captured & discarded by the trailing `\s*`. Valid SGML headers must // always be present in exactly this order, so a regular expression is acceptable. headerExp := regexp.MustCompile( - `OFXHEADER:\s*(?P\d+)\s*` + + `^OFXHEADER:\s*(?P\d+)\s*` + `DATA:\s*(?P[A-Z]+)\s*` + `VERSION:\s*(?P\d+)\s*` + `SECURITY:\s*(?P[\w]+)\s*` + @@ -62,7 +62,7 @@ func (or *Response) readSGMLHeaders(r *bufio.Reader) error { `CHARSET:\s*(?P[\w-]+)\s*` + `COMPRESSION:\s*(?P[A-Z]+)\s*` + `OLDFILEUID:\s*(?P[\w-]+)\s*` + - `NEWFILEUID:\s*(?P[\w-]+)\s*`) + `NEWFILEUID:\s*(?P[\w-]+)\s*<$`) matches := headerExp.FindStringSubmatch(s) if len(matches) == 0 { diff --git a/response_test.go b/response_test.go index d288607..5655613 100644 --- a/response_test.go +++ b/response_test.go @@ -176,8 +176,7 @@ func TestValidSamples(t *testing.T) { func TestInvalidResponse(t *testing.T) { // in this example, the severity is invalid due to mixed upper and lower case letters - const invalidResponse = ` -OFXHEADER:100 + const invalidResponse = `OFXHEADER:100 DATA:OFXSGML VERSION:102 SECURITY:NONE diff --git a/samples/valid_responses/wellsfargo.qfx b/samples/busted_responses/wellsfargo.qfx similarity index 100% rename from samples/valid_responses/wellsfargo.qfx rename to samples/busted_responses/wellsfargo.qfx