Skip to content

fix: handle non-string note attributes in note_hash computation#134

Open
yaniv-golan wants to merge 1 commit intovzhd1701:masterfrom
yaniv-golan:fix/dict-encode-crash
Open

fix: handle non-string note attributes in note_hash computation#134
yaniv-golan wants to merge 1 commit intovzhd1701:masterfrom
yaniv-golan:fix/dict-encode-crash

Conversation

@yaniv-golan
Copy link
Copy Markdown

Summary

  • When ENEX note-attributes contain nested XML elements, the parser returns dicts instead of strings
  • note_hash calls .encode("utf-8") on each field, which crashes with AttributeError: 'dict' object has no attribute 'encode'
  • Fix: coerce values to str() before encoding

Fixes #111

Test plan

  • Existing tests pass
  • Reproduced the issue with ENEX files containing nested note-attributes

When ENEX note-attributes contain nested XML elements, the parser
returns dicts instead of strings. Calling .encode() on a dict crashes
with AttributeError. Coerce to str() before encoding.

Fixes vzhd1701#111
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

Successfully merging this pull request may close these issues.

[Bug]: AttributeError: 'dict' object has no attribute 'encode'

1 participant