Skip to content

Commit

Permalink
Item14033: Incorrect fix for the ViewScriptTest
Browse files Browse the repository at this point in the history
It was failing because after splitting the path, which eliminates any
duplicate deliminters, it went ahead and used the un-split path for the
single component case.
  • Loading branch information
gac410 committed Jun 28, 2016
1 parent 0f9e07d commit dbb7b43
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions core/lib/Foswiki/Request.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,7 @@ sub parse {
print STDERR "Processing path ($query_path)\n" if TRACE;
my $topic_flag;

$query_path =~ s{/+}{/}g; # Remove duplicate slashes
$query_path =~ s{^/+}{/}g; # Remove duplicate leading slashes

# SMELL: The leading slash is *always* present in the pathInfo, but should
# not be there in the topic=blah query param. So if the leading slash is missing,
Expand All @@ -1037,14 +1037,16 @@ sub parse {
print STDERR "Checking single component: $query_path \n" if TRACE;
my $resp = {};
if ($topic_flag) {
$resp->{topic} = Foswiki::Sandbox::untaint( $query_path,
$resp->{topic} =
Foswiki::Sandbox::untaint( $parts[0],
\&Foswiki::Sandbox::validateTopicName );
$resp->{invalidTopic} = $query_path unless defined $resp->{topic};
$resp->{invalidTopic} = $parts[0] unless defined $resp->{topic};
}
else {
$resp->{web} = Foswiki::Sandbox::untaint( $query_path,
$resp->{web} =
Foswiki::Sandbox::untaint( $parts[0],
\&Foswiki::Sandbox::validateWebName );
$resp->{invalidWeb} = $query_path unless defined $resp->{web};
$resp->{invalidWeb} = $parts[0] unless defined $resp->{web};
}
return $resp;
}
Expand Down

0 comments on commit dbb7b43

Please sign in to comment.