From d79a01cfb14494cf8c90d9c50f7918e19205544f Mon Sep 17 00:00:00 2001 From: Firq Date: Fri, 5 Jul 2024 16:36:51 +0200 Subject: [PATCH] Fixed issue with bytes when saving credentials --- dockge_cli/service/storage.py | 4 ++-- pyproject.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dockge_cli/service/storage.py b/dockge_cli/service/storage.py index e4276a2..20ffb85 100644 --- a/dockge_cli/service/storage.py +++ b/dockge_cli/service/storage.py @@ -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(): """ diff --git a/pyproject.toml b/pyproject.toml index 75938fa..457eb3e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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",