Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Form Regex - different for add/modify .pm

Quote Reply
Form Regex - different for add/modify .pm
The problem is well explained here:

http://www.gossamer-threads.com/perl/gforum/gforum.cgi?post=236978


You (GT), already provided me a fix for this but the bug is still here ...


Fix for v.2.1.2



Just open the file admin/Links/User/Modify.pm


And then replace the following, around line #270:


foreach my $col_name ( keys %fcols ) {
if ( $args->{$col_name."_del"} ) { $save->{$col_name."_del"} = ''; next };
my $fh = $args->{$col_name};
ref $fh or ( $save->{$col_name} = '', next );
my $fname = GT::CGI->escape(get_filename("$fh"));
my $fpath = "$CFG->{admin_root_path}/tmp/$save->{ID}-$fname";
open F, ">$fpath";
binmode F; binmode $fh;
my $buf;
while( read $fh, $buf, 4096 ){ print F $buf; };
close F;
$save->{$col_name} = $fpath;
$save->{$col_name."_filename"} = get_filename("$fh");
}


with:


my $regex = $db->regex();
foreach my $col_name ( keys %fcols ) {
if ( $args->{$col_name."_del"} ) { $save->{$col_name."_del"} = ''; next };
my $fh = $args->{$col_name};
ref $fh or ( $save->{$col_name} = '', next );
my $fname = GT::CGI->escape(get_filename("$fh"));
my $r = $regex->{$col_name};
if ($fname !~ /$r/) {
$db->error ('ILLEGALVAL', 'WARN', $user_cols->{$col_name}->{form_display} || $col_name, $fname);
return { error => $GT::SQL::error, Category => $category, LinkID => $lid };
}
my $fpath = "$CFG->{admin_root_path}/tmp/$save->{ID}-$fname";
open F, ">$fpath";
binmode F; binmode $fh;
my $buf;
while( read $fh, $buf, 4096 ){ print F $buf; };
close F;
$save->{$col_name} = $fpath;
$save->{$col_name."_filename"} = get_filename("$fh");
}
Quote Reply
Re: [Payooo] Form Regex - different for add/modify .pm In reply to
Thanks, it should be fixed now.

Adrian