From f5bb22cf761a5fafd8af4cbeb3cb8ecf62485fd9 Mon Sep 17 00:00:00 2001 From: Marcel van der Veldt Date: Sun, 22 Feb 2026 14:44:14 +0100 Subject: [PATCH] More gracefully handle DLNA errors --- music_assistant/providers/dlna/helpers.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/music_assistant/providers/dlna/helpers.py b/music_assistant/providers/dlna/helpers.py index 7258c49e..8f525eaf 100644 --- a/music_assistant/providers/dlna/helpers.py +++ b/music_assistant/providers/dlna/helpers.py @@ -2,6 +2,7 @@ from __future__ import annotations +import xml.etree.ElementTree as ET from typing import TYPE_CHECKING from aiohttp.web import Request, Response @@ -40,7 +41,15 @@ class DLNANotifyServer(UpnpNotifyServer): # type: ignore[misc,unused-ignore] body=await request.text(), ) - status = await self.event_handler.handle_notify(http_request) + try: + status = await self.event_handler.handle_notify(http_request) + except ET.ParseError as err: + self.mass.logger.debug( + "Ignoring malformed XML in DLNA notify from %s: %s", + request.remote, + err, + ) + return Response(status=400) return Response(status=status) -- 2.34.1