mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-07-16 05:43:54 +03:00
[PR #9759] Rescue malformed Xml response in DLNA PlayTo #12215
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Original Pull Request: https://github.com/jellyfin/jellyfin/pull/9759
State: closed
Merged: Yes
Not all devices (TVs/Receivers/Tuners) appear to provide well-formed Xml responses when using the 'remote control' / 'PlayTo' functionality. Currently, in such cases Jellyfin becomes unable to provide remote control or song progress, behaving like nothing happened (while the remote device starts playing), and throws an exception in the log.
In this PR, when the XmlException is caught, it tries to escape unescaped & characters and then retries to read the Xml. If the Xml is now correct, Jellyfin will operate normally - if it is still not correct it will log the XmlException after all.
Changes
Add regex expression to the exception handler in DlnaHttpClient's SendRequestAsync function. Adding it there avoids interrupting the normal flow, but provides a rescue scenario for communicating with ill-behaving equipment.
Regex currently fixes unescaped ampersands, other corrections could easily be added.
Issues
Described in jellyfin/jellyfin-plugin-dlna#26. I'm not sure it fixes the original Bose issue, but does correct the behaviour with my amplifier.