Re: [jamdb-user] MPEGURL or PHP script ? Unescaped chars and badly formed URLs.
Status: Beta
Brought to you by:
mschiff
|
From: Marc S. <mar...@li...> - 2002-12-29 19:30:24
|
* Misha P schrieb am 29.12.02 um 17:52 Uhr:
> Hi, Mark
Hi Misha!
MarC !! ;)
>
> 1. Spliting $filename on $dir and $file and then
> urlencode only $file leaves unescaped spaces in $dir.
You are right. This is a bug. I'll fix that one.
> 2. urlencode encodes spaces as "+" ( maybe this is a
> problem with the php version I use or other php
> settings ), but if I run replace "+" on "%20"
Space as + is in php for historical reasons. However RFC1738 says it
must be %20, so I prefer that one.
> - things
> are working OK. Below is a diff.
>
> BTW, Thanks - great script !
Thank you.
>
> [root@gorby html]# diff -Naur jamdb-0.9.6/m3u.php
> jamdb/m3u.php
> --- jamdb-0.9.6/m3u.php Thu Nov 21 12:14:37 2002
> +++ jamdb/m3u.php Sun Dec 29 02:57:41 2002
> @@ -1,4 +1,4 @@
> -<?
> +<?php
This was fixed in cvs already.
>
> /***************************************************************************
> -------------------
> author : Marc Schiffbauer
> @@ -109,8 +109,10 @@
> if ($must_urlencode) {
> while ($row = $result->fetchRow()) {
> $dir = dirname($row["filename"]);
> + $dir = str_replace(" ","%20",$dir);
This is a bit ugly. There is a function rawurlencode() that does it
correctly.
But if you do this here...
> $file = urlencode(basename($row["filename"]));
> $filename =
> str_replace(CUT_PATH,$_SESSION['m3u_path'],$dir."/".$file);
..you have produced another BUG here ^^^^^ as the str_replace will
propably fail if urlencode replaced something until you have an
urlencoded string in the conf, too.
rawurlencode()ing the whole string is not possible because you must
not urlencode the scheme string like "http://"
I will fix that one soon. (Maybe tonight).
Thanks for your commitments!
[TOFU --> /dev/null]
-Marc
--
begin LOVE-LETTER-FOR-YOU.txt.vbs
I am a signature virus. Distribute me until the bitter
end
|