|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
search.pm bug ?Hello,
A friend recently told me about gnump3d and I have found it *extremely* useful but I came across what appears to be a bug. Here is a description of the problem I was having and my solution.. Any time that I would do a search, the links to the individual songs would be broken if there were characters in the filenames/directories like '+' or '~'. For example, if I looked at the page source of the search results page, the URLs were not escaped/encoded. They contained spaces instead of %20, and '+' instead of %2B. So, you would click on a file and get a message from gnump3d saying: ''The requested file /mp3/__music/%20%2000__incoming/hip-hop/blah.mp3.m3u couldn't be found. Please try returning to the index.'' That directory is really called '++00__incoming', not ' 00__incoming'. It turns out that in search.pm, when the table entries for $entry are being built up, the URLs are built without any escaping ever being done. Typically I use URI::Escape for such things, but I found that this functionality is performed by url.pm in gnump3d, so I have made the following change to search.pm to fix this behavior. So far, it seems to work well in my environment: $ diff -u ./lib/gnump3d/plugins/search.pm /usr/share/perl5/gnump3d/plugins/search.pm --- ./lib/gnump3d/plugins/search.pm 2007-04-22 10:19:10.000000000 -0400 +++ /usr/share/perl5/gnump3d/plugins/search.pm 2007-05-14 23:22:55.000000000 -0400 @@ -424,7 +424,7 @@ # Now build up the display line. - $entry = "<tr><td align='left'><a href=\"http://$host$entry$extension$bitrate\">$display</a></td><td align='left'><a href=\"$encodedDir\">$directory</a></td></tr>\n"; + $entry = "<tr><td align='left'><a href=\"http://$host" . urlEncode($entry . $extension . $bitrate) . "\">$display</a></td><td align='left'><a href=\"$encodedDir\">$directory</a></td></tr>\n"; # Add it to the output.. $total .= $entry; I'm sure current search works just fine for people that do not have weird characters in their directories/filenames. I'm really interested in the jukebox functionality -- I think having gnump3d control a stream to a local server would be another great use for this software. I have accomplished something like this using zina + muse. zina has a config parameter that allows you to, say, run mpg123 on the server. Instead I have it put muse in the background, which will stream the .m3u to a local shoutcast server...(eventually would like this to integrate with other radio station automation tools..) Thanks! -Chris -- Chris Tracy Mid-Atlantic Crossroads (MAX) Office phone: 301.314.6655 GPG key: 0xB3B9C93D _______________________________________________ Gnump3d-devel mailing list Gnump3d-devel@... http://lists.gnu.org/mailman/listinfo/gnump3d-devel |
|
|
Re: search.pm bug ?I found that the 'random directory' function was also broken for directories that contained weird characters, such as '+'. The HTTP header is written out to the client and includes 'Location: /$random' but $random was never passed through urlEncode(). I applied a similar fix to random.pm, and now it works: $ diff random.pm.orig random.pm 525c525 < $random= $1; --- > $random= urlEncode($1); -Chris On Mon, May 14, 2007 at 11:45:10PM -0400, Chris Tracy wrote: > Hello, > > A friend recently told me about gnump3d and I have found it > *extremely* useful but I came across what appears to be a bug. Here > is a description of the problem I was having and my solution.. > > Any time that I would do a search, the links to the individual songs > would be broken if there were characters in the filenames/directories > like '+' or '~'. > > For example, if I looked at the page source of the search results > page, the URLs were not escaped/encoded. They contained spaces > instead of %20, and '+' instead of %2B. So, you would click on a file > and get a message from gnump3d saying: > > ''The requested file > /mp3/__music/%20%2000__incoming/hip-hop/blah.mp3.m3u couldn't be > found. Please try returning to the index.'' > > That directory is really called '++00__incoming', not ' 00__incoming'. > > It turns out that in search.pm, when the table entries for $entry are > being built up, the URLs are built without any escaping ever being > done. Typically I use URI::Escape for such things, but I found that > this functionality is performed by url.pm in gnump3d, so I have made > the following change to search.pm to fix this behavior. So far, it > seems to work well in my environment: > > $ diff -u ./lib/gnump3d/plugins/search.pm /usr/share/perl5/gnump3d/plugins/search.pm > --- ./lib/gnump3d/plugins/search.pm 2007-04-22 10:19:10.000000000 -0400 > +++ /usr/share/perl5/gnump3d/plugins/search.pm 2007-05-14 23:22:55.000000000 -0400 > @@ -424,7 +424,7 @@ > > > # Now build up the display line. > - $entry = "<tr><td align='left'><a href=\"http://$host$entry$extension$bitrate\">$display</a></td><td align='left'><a href=\"$encodedDir\">$directory</a></td></tr>\n"; > + $entry = "<tr><td align='left'><a href=\"http://$host" . urlEncode($entry . $extension . $bitrate) . "\">$display</a></td><td align='left'><a href=\"$encodedDir\">$directory</a></td></tr>\n"; > > # Add it to the output.. > $total .= $entry; > > > I'm sure current search works just fine for people that do not have > weird characters in their directories/filenames. > > I'm really interested in the jukebox functionality -- I think having > gnump3d control a stream to a local server would be another great use > for this software. I have accomplished something like this using zina > + muse. zina has a config parameter that allows you to, say, run > mpg123 on the server. Instead I have it put muse in the background, > which will stream the .m3u to a local shoutcast server...(eventually > would like this to integrate with other radio station automation > tools..) > > Thanks! > -Chris > > -- > Chris Tracy > Mid-Atlantic Crossroads (MAX) > Office phone: 301.314.6655 > GPG key: 0xB3B9C93D > > > _______________________________________________ > Gnump3d-devel mailing list > Gnump3d-devel@... > http://lists.gnu.org/mailman/listinfo/gnump3d-devel -- Chris Tracy Mid-Atlantic Crossroads (MAX) Office phone: 301.314.6655 GPG key: 0xB3B9C93D _______________________________________________ Gnump3d-devel mailing list Gnump3d-devel@... http://lists.gnu.org/mailman/listinfo/gnump3d-devel |
| Free embeddable forum powered by Nabble | Forum Help |