Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OfxPreprocessedFile() crashes on an empty close tag like this: <MEMO/> #167

Open
toddInPortland opened this issue Apr 24, 2022 · 0 comments

Comments

@toddInPortland
Copy link

tokens that look like cause OfxPreprocessedFile() to set is_closing_tag=false and is_open_tag=true which, in turn causes re.findall() to fault. This flavor of token appears in the ofx file from my credit union, onpointcu.com. It may be encoded wrong, but the right fix would be a better parse code that does not allow the code to fault.

The fix is to add change OfxPreprocessedFile() so that is_closing_tag accounts for this.
I can push the patch, but I would need permission to push.

--- a/ofxparse/ofxparse.py
+++ b/ofxparse/ofxparse.py
@@ -169,7 +169,7 @@ class OfxPreprocessedFile(OfxFile):
         tokens = re.split(r'(?i)(</?[a-z0-9_\.]+>)', ofx_string)
         new_fh = StringIO()
         for token in tokens:
-            is_closing_tag = token.startswith('</')
+            is_closing_tag = token.startswith('</') or token.endswith('/>')
             is_processing_tag = token.startswith('<?')
             is_cdata = token.startswith('<!')
             is_tag = token.startswith('<') and not is_cdata

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant