mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 08:47:57 +00:00
For consistency use suggested_filename in Google Drive (#137061)
Use suggested_filename in Google Drive
This commit is contained in:
parent
9453b925cd
commit
bb61e31298
@ -11,7 +11,7 @@ from aiohttp import ClientSession, ClientTimeout, StreamReader
|
||||
from aiohttp.client_exceptions import ClientError, ClientResponseError
|
||||
from google_drive_api.api import AbstractAuth, GoogleDriveApi
|
||||
|
||||
from homeassistant.components.backup import AgentBackup
|
||||
from homeassistant.components.backup import AgentBackup, suggested_filename
|
||||
from homeassistant.config_entries import ConfigEntryState
|
||||
from homeassistant.const import CONF_ACCESS_TOKEN
|
||||
from homeassistant.exceptions import (
|
||||
@ -132,7 +132,7 @@ class DriveClient:
|
||||
"""Upload a backup."""
|
||||
folder_id, _ = await self.async_create_ha_root_folder_if_not_exists()
|
||||
backup_metadata = {
|
||||
"name": f"{backup.name} {backup.date}.tar",
|
||||
"name": suggested_filename(backup),
|
||||
"description": json.dumps(backup.as_dict()),
|
||||
"parents": [folder_id],
|
||||
"properties": {
|
||||
|
@ -140,7 +140,7 @@
|
||||
tuple(
|
||||
dict({
|
||||
'description': '{"addons": [{"name": "Test", "slug": "test", "version": "1.0.0"}], "backup_id": "test-backup", "date": "2025-01-01T01:23:45.678Z", "database_included": true, "extra_metadata": {"with_automatic_settings": false}, "folders": [], "homeassistant_included": true, "homeassistant_version": "2024.12.0", "name": "Test", "protected": false, "size": 987}',
|
||||
'name': 'Test 2025-01-01T01:23:45.678Z.tar',
|
||||
'name': 'Test_-_2025-01-01_01.23_45678000.tar',
|
||||
'parents': list([
|
||||
'HA folder ID',
|
||||
]),
|
||||
@ -211,7 +211,7 @@
|
||||
tuple(
|
||||
dict({
|
||||
'description': '{"addons": [{"name": "Test", "slug": "test", "version": "1.0.0"}], "backup_id": "test-backup", "date": "2025-01-01T01:23:45.678Z", "database_included": true, "extra_metadata": {"with_automatic_settings": false}, "folders": [], "homeassistant_included": true, "homeassistant_version": "2024.12.0", "name": "Test", "protected": false, "size": 987}',
|
||||
'name': 'Test 2025-01-01T01:23:45.678Z.tar',
|
||||
'name': 'Test_-_2025-01-01_01.23_45678000.tar',
|
||||
'parents': list([
|
||||
'new folder id',
|
||||
]),
|
||||
|
Loading…
x
Reference in New Issue
Block a user