[upnpcontrol] Fix IllegalArgumentException when downloading album art (#17965)

* Stip whitespace from album art URI

Signed-off-by: Dan Cunningham <dan@digitaldan.com>
This commit is contained in:
Dan Cunningham 2024-12-24 12:10:48 -08:00 committed by GitHub
parent 7c6e658f56
commit 0e5e48f763
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1648,12 +1648,12 @@ public class UpnpRendererHandler extends UpnpHandler {
} }
if (!(isCurrent if (!(isCurrent
&& (media.getAlbumArtUri().isEmpty() || media.getAlbumArtUri().contains("DefaultAlbumCover")))) { && (media.getAlbumArtUri().isEmpty() || media.getAlbumArtUri().contains("DefaultAlbumCover")))) {
if (media.getAlbumArtUri().isEmpty() || media.getAlbumArtUri().contains("DefaultAlbumCover")) { if (media.getAlbumArtUri().isBlank() || media.getAlbumArtUri().contains("DefaultAlbumCover")) {
updateState(ALBUM_ART, UnDefType.UNDEF); updateState(ALBUM_ART, UnDefType.UNDEF);
} else { } else {
State albumArt = null; State albumArt = null;
try { try {
albumArt = HttpUtil.downloadImage(media.getAlbumArtUri()); albumArt = HttpUtil.downloadImage(media.getAlbumArtUri().trim());
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
logger.debug("Invalid album art URI: {}", media.getAlbumArtUri(), e); logger.debug("Invalid album art URI: {}", media.getAlbumArtUri(), e);
} }