Skip to content

Commit 9d10e0e

Browse files
authored
Change webdav namespace to absolut URI (home-assistant#139456)
* Change webdav namespace to absolut URI * Add const file
1 parent 05df572 commit 9d10e0e

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

homeassistant/components/webdav/backup.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
METADATA_VERSION = "1"
3232
BACKUP_TIMEOUT = ClientTimeout(connect=10, total=43200)
33+
NAMESPACE = "https://home-assistant.io"
3334

3435

3536
async def async_get_backup_agents(
@@ -100,14 +101,14 @@ def _is_current_metadata_version(properties: list[Property]) -> bool:
100101
return any(
101102
prop.value == METADATA_VERSION
102103
for prop in properties
103-
if prop.namespace == "homeassistant" and prop.name == "metadata_version"
104+
if prop.namespace == NAMESPACE and prop.name == "metadata_version"
104105
)
105106

106107

107108
def _backup_id_from_properties(properties: list[Property]) -> str | None:
108109
"""Return the backup ID from properties."""
109110
for prop in properties:
110-
if prop.namespace == "homeassistant" and prop.name == "backup_id":
111+
if prop.namespace == NAMESPACE and prop.name == "backup_id":
111112
return prop.value
112113
return None
113114

@@ -186,12 +187,12 @@ async def async_upload_backup(
186187
f"{self._backup_path}/{filename_meta}",
187188
[
188189
Property(
189-
namespace="homeassistant",
190+
namespace=NAMESPACE,
190191
name="backup_id",
191192
value=backup.backup_id,
192193
),
193194
Property(
194-
namespace="homeassistant",
195+
namespace=NAMESPACE,
195196
name="metadata_version",
196197
value=METADATA_VERSION,
197198
),
@@ -252,11 +253,11 @@ async def _list_metadata_files(self) -> dict[str, str]:
252253
self._backup_path,
253254
[
254255
PropertyRequest(
255-
namespace="homeassistant",
256+
namespace=NAMESPACE,
256257
name="metadata_version",
257258
),
258259
PropertyRequest(
259-
namespace="homeassistant",
260+
namespace=NAMESPACE,
260261
name="backup_id",
261262
),
262263
],

tests/components/webdav/const.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020
"/Automatic_backup_2025.2.1_2025-02-10_18.31_30202686.tar": [],
2121
"/Automatic_backup_2025.2.1_2025-02-10_18.31_30202686.metadata.json": [
2222
Property(
23-
namespace="homeassistant",
23+
namespace="https://home-assistant.io",
2424
name="backup_id",
2525
value="23e64aec",
2626
),
2727
Property(
28-
namespace="homeassistant",
28+
namespace="https://home-assistant.io",
2929
name="metadata_version",
3030
value="1",
3131
),

0 commit comments

Comments
 (0)