mirror of
https://github.com/home-assistant/core.git
synced 2025-08-02 20:25:07 +02:00
Report backup size in bytes instead of MB (#131028)
Co-authored-by: Robert Resch <robert@resch.dev>
This commit is contained in:
@@ -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
|
||||
|
@@ -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)
|
||||
|
@@ -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."""
|
||||
|
@@ -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,
|
||||
)
|
||||
|
Reference in New Issue
Block a user