Skip to content

Commit

Permalink
Localstorage: fix missing cast to Path
Browse files Browse the repository at this point in the history
The current code assumed that `path` is already a `pathlib.Path` instance, despite it being a string. This commit fixes that.
  • Loading branch information
Akarys42 authored Jun 8, 2022
1 parent 681cbd7 commit 80ad5e6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions blackbox/handlers/databases/localstorage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 80ad5e6

Please sign in to comment.