From b224cd40f6d75dc720134206ff06a141a1835f6c Mon Sep 17 00:00:00 2001 From: Terranom674 Date: Thu, 20 Aug 2026 19:05:54 +0200 Subject: [PATCH] Fix Nextcloud image dimension XML parsing --- .../lib/build_webdav_placeholder_source.py | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/runtime/lib/build_webdav_placeholder_source.py b/runtime/lib/build_webdav_placeholder_source.py index 14b2e27..4903e4c 100644 --- a/runtime/lib/build_webdav_placeholder_source.py +++ b/runtime/lib/build_webdav_placeholder_source.py @@ -56,8 +56,30 @@ def safe_local_name(name: str) -> str: def parse_image_dimensions(prop: ET.Element) -> tuple[int, int]: - for property_name in ("file-metadata-size", "metadata-photos-size"): - raw = prop.findtext(f"{{{NC}}}{property_name}", default="").strip() + for property_name in ("metadata-photos-size", "file-metadata-size"): + element = prop.find(f"{{{NC}}}{property_name}") + if element is None: + continue + + width = 0 + height = 0 + for child in list(element): + local_name = child.tag.rsplit("}", 1)[-1] + text = (child.text or "").strip() + if not text: + continue + try: + value = int(text) + except ValueError: + continue + if local_name == "width": + width = value + elif local_name == "height": + height = value + if width > 0 and height > 0: + return width, height + + raw = (element.text or "").strip() if not raw: continue try: