From 7e96b15141fc8bfe9a4b3632f328fde59f5a2260 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 29 Jul 2010 09:24:56 -0700 Subject: [PATCH] Check for fragment existance. Clarify a test. --- lib/WebGUI/Asset.pm | 1 + t/Asset/dispatch.t | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/WebGUI/Asset.pm b/lib/WebGUI/Asset.pm index 9e3c6121e..8279fde74 100644 --- a/lib/WebGUI/Asset.pm +++ b/lib/WebGUI/Asset.pm @@ -574,6 +574,7 @@ A URL. sub dispatch { my ($self, $fragment) = @_; if (my $func = $self->session->form->param('func')) { + return undef if $fragment && $fragment ne $self->getUrl; if (my $sub = $self->can('www_'.$func)) { return $sub->(); } diff --git a/t/Asset/dispatch.t b/t/Asset/dispatch.t index d8ba67b90..f7f6106c6 100644 --- a/t/Asset/dispatch.t +++ b/t/Asset/dispatch.t @@ -86,7 +86,7 @@ ok( $output, "dispatch returned something, maybe not found page?" ); isnt( $output, "www_edit", "?func= dispatch cancelled because of unhandled fragment" ); $session->request->setup_body( { } ); -$output = $td->dispatch( '/bar' ); +$output = $td->dispatch( '/not-foo' ); ok( $output, "dispatch returned something, maybe not found page?" ); isnt( $output, "www_view", "?func= dispatch cancelled because of unhandled fragment" );