Bug 2874 - url encoded '&' (%26) in track name causes $client->execute(['playlist', 'insert', $track]) to fail
: url encoded '&' (%26) in track name causes $client->execute(['playlist', 'ins...
Status: CLOSED FIXED
Product: Logitech Media Server
Classification: Unclassified
Component: Plugin
: 6.2.1
: PC Windows (legacy)
: P2 normal (vote)
: ---
Assigned To: Dan Sully
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-01-25 21:41 UTC by terry turner
Modified: 2008-12-15 11:57 UTC (History)
0 users

See Also:
Category: ---


Attachments
zip file containing test plugin and log file (3.55 KB, application/octet-stream)
2006-02-16 21:46 UTC, terry turner
Details
ss log file (2.66 KB, application/x-zip-compressed)
2006-05-03 19:29 UTC, terry turner
Details

Note You need to log in before you can comment on or make changes to this bug.
Description terry turner 2006-01-25 21:41:08 UTC
 
Comment 1 terry turner 2006-01-25 21:42:55 UTC
url encoded '&' (%26) in track name causes $client->execute(['playlist', 'insert', $track]) to fail

e.g. $track =
"file:///export0/audio/cd/v/a/Various%20(Paul%20Weston%20%26%20His%20Orchestra)%20~%20Dancing%20and%20Romancing%20Through%20the%20'40s%20(Disc%203)%20~%2017%20~%20Some%20Enchanted%20Evening%20~%201949.flac";



Comment 2 terry turner 2006-01-27 22:22:43 UTC
the same problem occurs for '+' if it is url encoded. 
Comment 3 KDF 2006-01-27 23:08:53 UTC
failng how? do you have d_command logs showing the file not found, for example? d_playlist maybe?
Comment 4 terry turner 2006-01-27 23:40:30 UTC
the expected behavior with this plugin is that when the last track in the playlist starts another track is added. 

for tracks names that have either '+' or '&' url encoded no track is added to the end. sometimes the track is added but there is no name. if you click on the 'info' link you'll see the correct track but it will not play.

here is the log from the point where my plugin (nagog) calls execute. on this run no track was added to the end of the list in the ui and playing stopped when the last track finished playing. there were two items in the playlist when the insert of 'harry james' is executed. nagog is the plugin.


2006-01-27 23:29:52.8454 nagog.appendTrack: track [file:///export0/audio/cd/v/a/Various%20(Harry%20James%20%26%20His%20Orchestra)%20~%20Dancing%20and%20Romancing%20Through%20the%20'40s%20(Disc%201)%20~%2014%20~%20Ciribiribin%20~%201940.flac]
2006-01-27 23:29:52.8462  Executing command 00:04:20:05:d1:b7: playlist (insert) (file:///export0/audio/cd/v/a/Various%20(Harry%20James%20%26%20His%20Orchestra)%20~%20Dancing%20and%20Romancing%20Through%20the%20'40s%20(Disc%201)%20~%2014%20~%20Ciribiribin%20~%201940.flac) () () () () ()
2006-01-27 23:29:53.0022 Playlist: Jumping to song index: 1
2006-01-27 23:29:53.0030  Returning array: playlist (insert) (file:///export0/audio/cd/v/a/Various%20(Harry%20James%20%26%20His%20Orchestra)%20~%20Dancing%20and%20Romancing%20Through%20the%20'40s%20(Disc%201)%20~%2014%20~%20Ciribiribin%20~%201940.flac) () () () () ()
2006-01-27 23:29:53.0096 Playlist: Jumping to song index: 1
2006-01-27 23:29:53.0104 Playlist: Jumping to song index: 1
2006-01-27 23:29:53.0110 nagog.ccb: received command playlist load_done
2006-01-27 23:29:53.0123 nagog.ccb: received command: playlist, from tntss, song index = 1, playlistCount = 2
2006-01-27 23:29:53.1776 nagog.logTrackCallback: content
[ok^M
]
2006-01-27 23:30:22.9721 currentPlaylistChangeTime : Fri Jan 27 23:29:53 2006
2006-01-27 23:30:22.9726 currentPlaylistRender     : Fri Jan 27 23:29:52 2006
2006-01-27 23:30:22.9730 currentPlaylistRenderSkin :
2006-01-27 23:30:22.9733 currentPlaylistRenderStart: 0
2006-01-27 23:30:22.9735 skinOverride:
2006-01-27 23:30:22.9738 start: 0
2006-01-27 23:30:23.0401 End playlist build. 2 items
Comment 5 KDF 2006-02-07 00:26:00 UTC
if this is for a plugin, try wrapping the url in:

Slim::Utils::Misc::unescape(...)
Comment 6 terry turner 2006-02-07 08:11:16 UTC
i guess you mean Slim::Web::HTTP::unescape. yes i had tried that when i first encountered the problem and it fixes the '&' and '+' problem. this leads to another problem: file names with ';' fail if unescape is called. note in the example below that the ';' is not encoded before calling unescape.

this is the test code:

$track = "file:///export1/audio/cd/v/a/Various%20(Ronald%20Stein)%20~%20Not%20o\
f%20this%20Earth!%20-%20The%20Film%20Music%20of%20Ronald%20Stein%20~%2007%20~%2\
0Attack%20of%20the%2050%20Ft.%20Woman%20-%20Nancy%20Got%20Her%20Man;%20Big%20Fi\
nish.flac";
$track = Slim::Web::HTTP::unescape($track);
$::d_plugins && msg("nagog.appendTrack: track [" . $track . "]\n");
$client->execute(['playlist', 'insert', $track]);

---

this is the log:
2006-02-07 07:59:16.7956 nagog.appendTrack: track [file:///export1/audio/cd/v/a\
/Various (Ronald Stein) ~ Not of this Earth! - The Film Music of Ronald Stein ~\
 07 ~ Attack of the 50 Ft. Woman - Nancy Got Her Man; Big Finish.flac]
2006-02-07 07:59:16.7964  Executing command 00:04:20:05:d1:b7: playlist (insert\
) (file:///export1/audio/cd/v/a/Various (Ronald Stein) ~ Not of this Earth! - T\
he Film Music of Ronald Stein ~ 07 ~ Attack of the 50 Ft. Woman - Nancy Got Her\
 Man; Big Finish.flac) () () () () ()
2006-02-07 07:59:17.1323  Returning array: playlist (insert) (file:///export1/a\
udio/cd/v/a/Various (Ronald Stein) ~ Not of this Earth! - The Film Music of Ron\
ald Stein ~ 07 ~ Attack of the 50 Ft. Woman - Nancy Got Her Man; Big Finish.fla\
c) () () () () ()
2006-02-07 07:59:17.1341 nagog.logTrackCallback: content
[null
]
2006-02-07 07:59:17.1379 nagog.ccb: received command playlist load_done
2006-02-07 07:59:17.1395 nagog.ccb: received command: playlist, from tntss, son\
g index = 10, playlistCount = 11

Comment 7 KDF 2006-02-07 09:12:11 UTC
currect routine, but it is moved in nightly builds for 6.5 at least.  Have you tried 6.2.2 as instructed on the bugzilla main page?

That last log, which switches are you using.  It is horribly hard to read.  I may help if you attach them in future rather than simply pasting, as it avoids the line wraps.
Comment 8 terry turner 2006-02-16 21:44:40 UTC
symptom: 
when the plugin calls 
  $client->execute(['playlist', 'insert', $track]);

and $track is a file name with a semicolon, ';', the track is not inserted into the playlist.

expected behavior:
the track should be inserted at the end of the playlist.


i've attached a test plugin that has a callback that appends a track when the callback receives a 'play' command and the current track is the last in the playlist.

the filename of the track that is inserted into the playlist is hardcoded. note that there is a semicolon in the file name.

also attached is the slimserver.log with d_plugin, d_command and d_playlist 'on'.
Comment 9 terry turner 2006-02-16 21:46:36 UTC
Created attachment 1146 [details]
zip file containing test plugin and log file
Comment 10 Blackketter Dean 2006-04-23 22:54:27 UTC
I tested using 

playlist add file:///Users/dean/Music/testmusic/zzz%20-%20mp3/Sourwood%3BMountain.mp3

command and it worked fine.    but I did find that:

playlist add file:///Users/dean/Music/testmusic/zzz%20-%20mp3/Sourwood;Mountain.mp3

did not, while it should have (as I interpret RFC1738.)

Is this consistent with what you are seeing, terry?

Also, can you test again with --d_command --d_paths --d_files turned on for  your cases?

(I think that this is a low-level bug in the CPAN URI module, or confusion on my part.  additional details would be helpful.)
Comment 11 terry turner 2006-05-03 19:27:12 UTC
this is what i see. if a file has an unencoded semicolon then slim server fails to append the track to the playlist *but* if the semicolon is encoded it is successfully appended. 

this fails (semicolon follows the word 'man'):
"file:///export1/audio/cd/v/a/Various%20(Ronald%20Stein)%20~%20Not%20of%20this%20Earth!%20-%20The%20Film%20Music%20of%20Ronald%20Stein%20~%2007%20~%20Attack%20of%20the%2050%20Ft.%20Woman%20-%20Nancy%20Got%20Her%20Man;%20Big%20Finish.flac"

this succeeds:
"file:///export1/audio/cd/v/a/Various%20(Ronald%20Stein)%20~%20Not%20of%20this%20Earth!%20-%20The%20Film%20Music%20of%20Ronald%20Stein%20~%2007%20~%20Attack%20of%20the%2050%20Ft.%20Woman%20-%20Nancy%20Got%20Her%20Man%3B%20Big%20Finish.flac"

the only other character that i've found to cause this problem is '#'.

calling Slim::Web::HTTP::unescape($track) on a track name that is url encoded works *unless* there is a semicolon or pound ('#') in the name. for now i have a very ugly reencode semicolon/pound following that.


Comment 12 terry turner 2006-05-03 19:29:07 UTC
Created attachment 1226 [details]
ss log file
Comment 13 Dan Sully 2006-07-23 18:13:28 UTC
Is this still an issue with the latest 6.5 nightly?

Thanks
Comment 14 Dan Sully 2006-07-24 12:56:58 UTC
Just tested - using an un-escaped ; works in 6.5
Comment 15 terry turner 2007-03-30 20:44:06 UTC
verified on slimserver 6.5.1
Comment 16 James Richardson 2008-12-15 11:57:56 UTC
This bug has been fixed in the latest release of SqueezeCenter!

Please download the new version from http://www.slimdevices.com/su_downloads.html if you haven't already.  

If you are still experiencing this problem, feel free to reopen the bug with your new comments and we'll have another look.