From 698f573a652c2342df1bb938d2af5e39ef751da4 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Mon, 13 Jul 2015 14:31:56 -0400 Subject: [PATCH] Fix broken add track action Fix the bug I've introduced in my PR #78, breaking the add track/playlist action. We have to decode URIs before sending them back to our socket! fixes #80 --- htdocs/js/mpd.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/js/mpd.js b/htdocs/js/mpd.js index 55acf6b..49a4656 100644 --- a/htdocs/js/mpd.js +++ b/htdocs/js/mpd.js @@ -243,7 +243,7 @@ function webSocketConnect() { "") .find('a').click(function(e) { e.stopPropagation(); - socket.send(onClickAction + "," + $(this).parents("tr").attr("uri")); + socket.send(onClickAction + "," + decodeURI($(this).parents("tr").attr("uri"))); $('.top-right').notify({ message:{ text: $('td:nth-child(2)', $(this).parents("tr")).text() + " added" @@ -264,7 +264,7 @@ function webSocketConnect() { app.setLocation("#/browse/0/"+$(this).attr("uri")); break; case 'song': - socket.send("MPD_API_ADD_TRACK," + $(this).attr("uri")); + socket.send("MPD_API_ADD_TRACK," + decodeURI($(this).attr("uri"))); $('.top-right').notify({ message:{ text: $('td:nth-child(2)', this).text() + " added" @@ -272,7 +272,7 @@ function webSocketConnect() { }).show(); break; case 'plist': - socket.send("MPD_API_ADD_PLAYLIST," + $(this).attr("uri")); + socket.send("MPD_API_ADD_PLAYLIST," + decodeURI($(this).attr("uri"))); $('.top-right').notify({ message:{ text: "Playlist " + $('td:nth-child(2)', this).text() + " added"