From 80ad5e632862ea0731f9a9ef0ecba3bba6d80023 Mon Sep 17 00:00:00 2001 From: Matteo Bertucci Date: Wed, 8 Jun 2022 22:26:27 +0200 Subject: [PATCH] Localstorage: fix missing cast to Path The current code assumed that `path` is already a `pathlib.Path` instance, despite it being a string. This commit fixes that. --- blackbox/handlers/databases/localstorage.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/blackbox/handlers/databases/localstorage.py b/blackbox/handlers/databases/localstorage.py index 03cb466..5650694 100644 --- a/blackbox/handlers/databases/localstorage.py +++ b/blackbox/handlers/databases/localstorage.py @@ -24,14 +24,14 @@ def __init__(self, **kwargs) -> None: super().__init__(**kwargs) - def backup(self, backup_path: Path) -> Path: + def backup(self, backup_path: Path) -> None: path = self.config["path"] compression_level = self.config.get("compression_level", 5) # Store evey file in the archive # We use deflate (Gzip) for compression and the level has already been validated in __init__ with ZipFile(backup_path, "w", ZIP_DEFLATED, compresslevel=compression_level) as zipfile: - for subpath in path.rglob("*"): + for subpath in Path(path).rglob("*"): if subpath.is_file(): zipfile.write(subpath)