Fixed issue with bytes when saving credentials
All checks were successful
/ pylint (push) Successful in 11s
/ mypy (push) Successful in 12s
/ lint-and-typing (push) Successful in 16s
/ build-artifacts (push) Successful in 8s
/ publish-artifacts (push) Successful in 9s

This commit is contained in:
Firq 2024-07-05 16:36:51 +02:00
parent 68f05a0c0c
commit d79a01cfb1
Signed by: Firq
GPG key ID: 3ACC61C8CEC83C20
2 changed files with 3 additions and 3 deletions

View file

@ -24,7 +24,7 @@ def put(key: str, value: str, encoded=False):
fileexists()
with open(_file, "r+", encoding="utf-8") as file:
content: dict[str, str] = yaml.load(file, Loader=yaml.SafeLoader) or {}
content.update({ key: str(base64.b64encode(value.encode())) if encoded else value })
content.update({ key: str(base64.b64encode(value.encode()), "utf-8") if encoded else value })
with open(_file, "w+", encoding="utf-8") as file:
yaml.dump(content, file, Dumper=yaml.SafeDumper)
@ -52,7 +52,7 @@ def get(key: str, encoded=False):
value = content.get(key, None)
if value is None:
return None
return base64.b64decode(value).decode() if encoded else value
return base64.b64decode(value.encode()).decode() if encoded else value
def clear():
"""

View file

@ -1,6 +1,6 @@
[project]
name = "dockge_cli"
version = "0.1.0-c.1"
version = "0.1.0-c.2"
dependencies = [
"pyyaml~=6.0.1",
"pydantic~=2.8.0",