Add Series from cgi fails.

dinkypumpkin dinkypumpkin at gmail.com
Fri Jun 28 07:58:55 EDT 2013


On 28/06/2013 00:18, Arthur Murray wrote:
> Using "Add Series" from the get_iplayer.cgi on a prog name with a
> question mark in it ("Who Were the Greeks?") fills in the "search0"
> field of the pvr file with the question mark and therefore does not
> match. (search0 ^Who Were the Greeks?$).  If the question mark is
> escaped it will match (search0 ^Who Were the Greeks\?$).  What is the
> correct place to correct this, in the cgi, or in get_iplayer and
> specifically where?
>
> (Encoding the question mark to ? doesn't work, only escaping it does.)
>
> # from cgi
> # Add Series
> $links .= label( {
>          -id=>'nowrap',
>          -class=>'search pointer_noul',
>          -title=>"Add Series '$prog{$pid}->{name}' to PVR",
>          -onClick=>"BackupFormVars(form);
> form.NEXTPAGE.value='pvr_add';
> form.SEARCH.value='".encode_entities("^$prog{$pid}->{name}\$")."'; ...
>
>
> Sample of ugly fixing in cgi:
>
>   my $encoded = encode_entities("^$prog{$pid}->{name}\$");
>   $encoded =~ s/\?/\\\\\\\?/;
>
> ... form.SEARCH.value='$encoded';  ...

You're in the right place.  Try this patch:

https://github.com/dinkypumpkin/get_iplayer/commit/e43249cb3e857fffed07601d67c190d641076be8

You can apply it directly from:

https://github.com/dinkypumpkin/get_iplayer/commit/e43249cb3e857fffed07601d67c190d641076be8.patch

This patch escapes every non-alphanumeric character in the programme 
name and then removes the escaping from whitespace characters for 
readability.  The question mark is probably the only problematic 
character likely to appear in programme names, but we might as well make 
the escaping generic.  If this change works for you I'll merge it into 
get_iplayer.





More information about the get_iplayer mailing list