From: <jgr...@us...> - 2003-02-28 00:21:08
|
Update of /cvsroot/popfile/engine/UI In directory sc8-pr-cvs1:/tmp/cvs-serv9180/UI Modified Files: HTML.pm Log Message: Added code to make sure that magnets do not have trailing or leading space and to automatically fix old magnets saved in the magnets files that have leading and trailing space Index: HTML.pm =================================================================== RCS file: /cvsroot/popfile/engine/UI/HTML.pm,v retrieving revision 1.97 retrieving revision 1.98 diff -C2 -d -r1.97 -r1.98 *** HTML.pm 27 Feb 2003 20:11:26 -0000 1.97 --- HTML.pm 28 Feb 2003 00:21:03 -0000 1.98 *************** *** 1352,1355 **** --- 1352,1364 ---- if ( $found == 0 ) { + + # It is possible to type leading or trailing white space in a magnet definition + # which can later cause mysterious failures because the whitespace is eaten by + # the browser when the magnet is displayed but is matched in the regular expression + # that does the magnet matching and will cause failures... so strip off the whitespace + + $self->{form}{text} =~ s/^[ \t]+//; + $self->{form}{text} =~ s/[ \t]+$//; + $self->{classifier}->{magnets}{$self->{form}{bucket}}{$self->{form}{type}}{$self->{form}{text}} = 1; $magnet_message = "<blockquote>" . sprintf( $self->{language}{Magnet_Error3}, "$self->{form}{type}: $self->{form}{text}", $self->{form}{bucket} ) . "</blockquote>"; |