Report backup size in bytes instead of MB (#131028)

Co-authored-by: Robert Resch <robert@resch.dev>
This commit is contained in:
Erik Montnemery
2024-11-20 14:08:07 +01:00
committed by GitHub
parent e08fe57bf3
commit 3e01e393a8
4 changed files with 4 additions and 4 deletions

View File

@@ -56,7 +56,7 @@ class CoreLocalBackupAgent(LocalBackupAgent):
backup_id=base_backup.backup_id,
name=base_backup.name,
date=base_backup.date,
size=round(backup_path.stat().st_size / 1_048_576, 2),
size=backup_path.stat().st_size,
protected=base_backup.protected,
)
backups[backup.backup_id] = backup

View File

@@ -613,7 +613,7 @@ class CoreBackupReaderWriter(BackupReaderWriter):
date=date_str,
name=backup_name,
protected=password is not None,
size=round(size_in_bytes / 1_048_576, 2),
size=size_in_bytes,
)
success = True
return (backup, tar_file_path)

View File

@@ -11,7 +11,7 @@ class BaseBackup:
date: str
name: str
protected: bool
size: float
size: int
def as_dict(self) -> dict:
"""Return a dict representation of this backup."""

View File

@@ -24,5 +24,5 @@ def read_backup(backup_path: Path) -> BaseBackup:
date=cast(str, data["date"]),
name=cast(str, data["name"]),
protected=cast(bool, data.get("protected", False)),
size=round(backup_path.stat().st_size / 1_048_576, 2),
size=backup_path.stat().st_size,
)