Ignore trailing slashes in requested URLS. Fixes bug #11865.
This commit is contained in:
parent
1fa03c3ad8
commit
1131a5b4bc
3 changed files with 12 additions and 2 deletions
|
|
@ -5,6 +5,7 @@
|
||||||
- fixed #11833: Recheck for losing Product Images
|
- fixed #11833: Recheck for losing Product Images
|
||||||
- fixed #11788: Calendar - Can't enter Midnight - Broke page layout
|
- fixed #11788: Calendar - Can't enter Midnight - Broke page layout
|
||||||
- fixed #11855: Purging Shortcut from Trash causes loop
|
- fixed #11855: Purging Shortcut from Trash causes loop
|
||||||
|
- fixed #11865: URL with slash no longer works.
|
||||||
|
|
||||||
7.10.0
|
7.10.0
|
||||||
- fixed #11812: Checking www_ajaxSave's response in the cart js, urlencoding post parameters
|
- fixed #11812: Checking www_ajaxSave's response in the cart js, urlencoding post parameters
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,7 @@ The URL for this request.
|
||||||
sub dispatch {
|
sub dispatch {
|
||||||
my $session = shift;
|
my $session = shift;
|
||||||
my $assetUrl = shift;
|
my $assetUrl = shift;
|
||||||
|
$assetUrl =~ s{/$}{};
|
||||||
my $permutations = getUrlPermutations($assetUrl);
|
my $permutations = getUrlPermutations($assetUrl);
|
||||||
foreach my $url (@{ $permutations }) {
|
foreach my $url (@{ $permutations }) {
|
||||||
if (my $asset = getAsset($session, $url)) {
|
if (my $asset = getAsset($session, $url)) {
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ WebGUI::Test->addToCleanup( WebGUI::VersionTag->getWorking( $session ) );
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
# Tests
|
# Tests
|
||||||
|
|
||||||
plan tests => 23; # Increment this number for each test you create
|
plan tests => 25; # Increment this number for each test you create
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
# test getUrlPermutation( url ) method
|
# test getUrlPermutation( url ) method
|
||||||
|
|
@ -138,15 +138,23 @@ cmp_deeply(
|
||||||
[ $utf8_url ],
|
[ $utf8_url ],
|
||||||
"UTF-8 handling for URLs",
|
"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
|
# test dispatch( session, url ) method
|
||||||
is ($session->asset, undef, 'session asset is not defined, yet');
|
is ($session->asset, undef, 'session asset is not defined, yet');
|
||||||
$output = WebGUI::Content::Asset::dispatch( $session, "testdispatch" );
|
$output = WebGUI::Content::Asset::dispatch( $session, "testdispatch" );
|
||||||
is $output, "www_view one", "Regular www_view";
|
is $output, "www_view one", "Regular www_view";
|
||||||
|
|
||||||
is $session->asset && $session->asset->getId, $td->getId, 'dispatch set the session asset';
|
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);
|
my $_asset = WebGUI::Asset->newByUrl($session, $utf8_url);
|
||||||
isa_ok $_asset, 'WebGUI::Asset::TestDispatch';
|
isa_ok $_asset, 'WebGUI::Asset::TestDispatch';
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue