Ignore trailing slashes in requested URLS. Fixes bug #11865.

This commit is contained in:
Colin Kuskie 2010-09-14 10:01:57 -07:00
parent 35412fbead
commit 0d2c4d6ba8
3 changed files with 11 additions and 1 deletions

View file

@ -5,6 +5,7 @@
- fixed #11833: Recheck for losing Product Images
- fixed #11788: Calendar - Can't enter Midnight - Broke page layout
- fixed #11855: Purging Shortcut from Trash causes loop
- fixed #11865: URL with slash no longer works.
7.10.0
- fixed #11812: Checking www_ajaxSave's response in the cart js, urlencoding post parameters

View file

@ -61,6 +61,7 @@ The URL for this request.
sub dispatch {
my $session = shift;
my $assetUrl = shift;
$assetUrl =~ s{/$}{};
my $permutations = getUrlPermutations($assetUrl);
foreach my $url (@{ $permutations }) {
if (my $asset = getAsset($session, $url)) {

View file

@ -131,15 +131,23 @@ cmp_deeply(
[ $utf8_url ],
"UTF-8 handling for URLs",
);
cmp_deeply(
WebGUI::Content::Asset::getUrlPermutations( "/one/two/three/" ),
[ '/one/two/three', '/one/two', '/one', ],
"trailing slashes are ignored",
);
#----------------------------------------------------------------------------
# test dispatch( session, url ) method
is ($session->asset, undef, 'session asset is not defined, yet');
$output = WebGUI::Content::Asset::dispatch( $session, "testdispatch" );
is $output, "www_view one", "Regular www_view";
is $session->asset && $session->asset->getId, $td->getId, 'dispatch set the session asset';
$output = WebGUI::Content::Asset::dispatch( $session, "testdispatch/" );
is $output, "www_view one", "trailing slashes are ignored";
my $_asset = WebGUI::Asset->newByUrl($session, $utf8_url);
isa_ok $_asset, 'WebGUI::Asset::TestDispatch';