💥 fix(center-window/big-media): art url not showing if file protocol is specified

This commit is contained in:
retrozinndev
2025-03-10 20:24:05 -03:00
parent 902361d74e
commit 19c90581ae
+7 -7
View File
@@ -172,15 +172,15 @@ export function BigMedia(): Gtk.Widget {
* @param player the player you want to pull album art from * @param player the player you want to pull album art from
* @returns Binding to player.artUrl containing the album art uri, or an undefined binding ig none was found. * @returns Binding to player.artUrl containing the album art uri, or an undefined binding ig none was found.
* */ * */
function getAlbumArt(player: AstalMpris.Player): Binding<string|undefined> { function getAlbumArt(player: AstalMpris.Player): Binding<string | undefined> {
return bind(player, "artUrl").as((artUrl: string) => { return bind(player, "artUrl").as((artUrl: string) => {
const finalUrl: string = artUrl;
if(/^(https|http)$/.test(finalUrl.split("://")[0])) if(!artUrl)
return artUrl; return undefined;
else if(artUrl.startsWith("/"))
if(artUrl.startsWith("/"))
return "file://" + artUrl; return "file://" + artUrl;
return undefined; return artUrl;
}); });
} }