gokeepasslib: Writing "&" character in entry title fails

Fails = Keepass tells that the file is corrupted.

Probably also fails with any other elements (UserName, Password), in Entry’s Values member.

Code to reproduce: https://github.com/tobischo/gokeepasslib/blob/master/examples/example-writing.go (change “My GMail password” to “Foo & Bar”).

Foo & Bar works, so apparently the user of the API has to be aware of the XML-backedness, which was a bit surprising to me.

Shouldn’t gokeepasslib do the XML-escaping? Or if not, maybe we should change mkValue() and mkProtectedValue() in the file writing example to do the XML-escaping, so not more people stumble with this.

Is this true in the reading direction as well, that when you read the file with Title containing &, we get that back instead of &?

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 16 (16 by maintainers)

Commits related to this issue

Most upvoted comments

Sorry it took me so long… been super busy here and managed just now to continue my hobby project (https://github.com/function61/pi-security-module)…

Managed to test it now, it works. 👍 Thanks, you’re awesome! 😃