Skip to content

Commit

Permalink
Item13549: Add backslash to NameFilter
Browse files Browse the repository at this point in the history
  • Loading branch information
gac410 committed Jul 22, 2015
1 parent 1f5511f commit 4763da0
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions UnitTestContrib/test/unit/RobustnessTests.pm
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,17 @@ sub test_sanitizeAttachmentName {
$crap .= $c if $c =~ m/$Foswiki::cfg{NameFilter}/;
}

#$this->assert_num_equals(80, length($crap));
$this->assert_num_equals( 51, length($crap) );
my $hex = '';
foreach my $ch ( split( //, $crap ) ) {
$hex .=
( $ch lt "\x20" || $ch gt "\x7e" ) ? '\x' . unpack( "H2", $ch ) : $ch;
}

my $expecthex =
'\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f "#$%&\'*;<>?@[\]^`|~';
$this->assert_str_equals( $expecthex, $hex,
"Expected: ($expecthex)\n Got: ($hex)\nHas {NameFilter} changed?" );
$this->assert_num_equals( 52, length($crap) );
my $x = $crap =~ m/ / ? '_' : '';
$this->assert_str_equals( "pick_me${x}pick_me",
_sanitize("pick me${crap}pick me") );
Expand Down

0 comments on commit 4763da0

Please sign in to comment.