Skip to content

Commit

Permalink
Normalize Encryption File Read Line Endings (#379)
Browse files Browse the repository at this point in the history
* normalize line ending to that of terminal

* preserve line endling when reading

* preserve line ending when reading key content
  • Loading branch information
rjra2611 authored Nov 13, 2023
1 parent abfa74f commit ba178d0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lean/components/util/encryption_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def get_project_key(project_key_path: Path, organization_id: str) -> str:
:param project_key_path: The path to the project key file
:return: The project key
"""
with open(project_key_path, 'r') as f:
with open(project_key_path, 'r', encoding='utf-8', newline='') as f:
content = f.read()
key_for_aes = _get_fixed_length_key_from_user_full_length_key(content, organization_id.encode('utf-8'))
return key_for_aes
Expand All @@ -60,7 +60,7 @@ def get_project_key_hash(project_key_path: Path):
:param project_key_path: The path to the project key file
:return: The project iv
"""
with open(project_key_path, 'r', encoding='utf-8') as f:
with open(project_key_path, 'r', encoding='utf-8', newline='') as f:
content = f.read()
return calculate_md5(content)

Expand Down

0 comments on commit ba178d0

Please sign in to comment.