diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 64f26cca0..12c72b300 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -1,5 +1,6 @@ 7.10.1 - fixed #11851: Story Topic: top story variables should be available all the time + - fixed #11854: CS doesn't return Not Found page 7.10.0 - fixed #11812: Checking www_ajaxSave's response in the cart js, urlencoding post parameters diff --git a/lib/WebGUI/Content/Asset.pm b/lib/WebGUI/Content/Asset.pm index 68f29f9dc..da652d4d8 100644 --- a/lib/WebGUI/Content/Asset.pm +++ b/lib/WebGUI/Content/Asset.pm @@ -81,6 +81,7 @@ sub dispatch { return $output if defined $output; } } + $session->clearAsset; if ($session->var->isAdminOn) { my $asset = WebGUI::Asset->newByUrl($session, $session->url->getRefererUrl) || WebGUI::Asset->getDefault($session); return $asset->addMissing($assetUrl); diff --git a/lib/WebGUI/Role/Asset/RssFeed.pm b/lib/WebGUI/Role/Asset/RssFeed.pm index 00d495091..0b7a08936 100644 --- a/lib/WebGUI/Role/Asset/RssFeed.pm +++ b/lib/WebGUI/Role/Asset/RssFeed.pm @@ -140,7 +140,7 @@ sub dispatch { elsif ($fragment eq '.rdf') { return $self->www_viewRdf; } - return $self->next::method(); + return $self->next::method($fragment); } #------------------------------------------------------------------- diff --git a/lib/WebGUI/Session.pm b/lib/WebGUI/Session.pm index 8bd660e69..922d4d93f 100644 --- a/lib/WebGUI/Session.pm +++ b/lib/WebGUI/Session.pm @@ -153,6 +153,18 @@ sub cache { $self->{_cache} = $cache; } return $self->{_cache}; + +#------------------------------------------------------------------- + +=head2 clearAsset ( ) + +Clears out the session asset. + +=cut + +sub clearAsset { + my $self = shift; + $self->{_asset} = undef; } #------------------------------------------------------------------- diff --git a/t/Content/Asset.t b/t/Content/Asset.t index 354b7dae8..9942c533a 100644 --- a/t/Content/Asset.t +++ b/t/Content/Asset.t @@ -15,6 +15,7 @@ use strict; use Test::More; +use Test::MockObject::Extends; use Test::Deep; use Data::Dumper; use WebGUI::Test; # Must use this before any other WebGUI modules @@ -87,11 +88,6 @@ my $utf8 WebGUI::Test->addToCleanup( WebGUI::VersionTag->getWorking( $session ) ); -#---------------------------------------------------------------------------- -# Tests - -plan tests => 25; # Increment this number for each test you create - #---------------------------------------------------------------------------- # test getUrlPermutation( url ) method @@ -230,4 +226,18 @@ my $output = WebGUI::Content::Asset::handler( $notModifiedSession ); isnt( $notModifiedSession->http->getStatus, "304", "logged in user doesn't get 304" ); ok( !$notModifiedSession->closed, "session is not closed" ); +# Test that requesting a URL that doesn't exist, but one of the permutations does exist, returns undef +#my $default = WebGUI::Asset->getDefault($session); +#my $mockDefault = Test::MockObject::Extends->new($default); +#$mockDefault->mock('addMissing', sub { return "add missing" }); + +$session->request->setup_body({ }); +my $nonexistant_url = WebGUI::Asset->getDefault($session)->get('url'); +$nonexistant_url = join '/', $nonexistant_url, 'nothing_here_to_see'; +$output = WebGUI::Content::Asset::dispatch( $session, $nonexistant_url ); +is $output, undef, 'getting a URL which does not exist returns undef'; +is $session->asset, undef, '... session asset is not set'; + +done_testing; + #vim:ft=perl