Skip to content

Commit

Permalink
Merge pull request #44 from schraal/#43
Browse files Browse the repository at this point in the history
#43: remember and reset file pointer location
  • Loading branch information
earthpyy authored Oct 30, 2024
2 parents 168dc5c + 72672d1 commit b787bb7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion secured_fields/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,11 @@ def _open(self, name, mode='rb'):
return File(BytesIO(decrypted_content))

def _save(self, name, content):
pos = content.tell()
content.seek(0)
encrypted_content = get_fernet().encrypt(content.read())
content.seek(0)
content.write(encrypted_content)
content.seek(0)
content.seek(pos)

return super()._save(name, content)

0 comments on commit b787bb7

Please sign in to comment.