Prevent an empty AssetProxy macro from causing an infinite loop. Fixes bug #12046. Thanks to Trex for the patch!
This commit is contained in:
parent
6865fda6e1
commit
90dec24634
3 changed files with 20 additions and 12 deletions
|
|
@ -4,6 +4,7 @@
|
|||
- fixed #12045: Job listing template, missing summary
|
||||
- fixed #12043: Collaboration Systems don't pull mail that fast!
|
||||
- fixed #12044: Spectre::Cron and non-integer time units
|
||||
- fixed #12046: Empty AssetProxy creates infinite loop (Dale Trexel)
|
||||
|
||||
7.10.9
|
||||
- fixed #12030: Calendar Feed Time Zone Issue
|
||||
|
|
|
|||
|
|
@ -42,6 +42,15 @@ Defaults to 'url'. But if you want to use an assetId as the first parameter, the
|
|||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($session, $identifier, $type) = @_;
|
||||
if (!$identifier) {
|
||||
$session->errorHandler->warn('AssetProxy macro called without an asset to proxy. '
|
||||
. 'The macro was called through this url: '.$session->asset->get('url'));
|
||||
if ($session->var->isAdminOn) {
|
||||
my $i18n = WebGUI::International->new($session, 'Macro_AssetProxy');
|
||||
return $i18n->get('invalid url');
|
||||
}
|
||||
return;
|
||||
}
|
||||
my $t = ($session->errorHandler->canShowPerformanceIndicators()) ? [Time::HiRes::gettimeofday()] : undef;
|
||||
my $asset;
|
||||
if ($type eq 'assetId') {
|
||||
|
|
|
|||
|
|
@ -14,24 +14,22 @@ use lib "$FindBin::Bin/../lib";
|
|||
|
||||
use WebGUI::Test;
|
||||
use WebGUI::Session;
|
||||
use HTML::TokeParser;
|
||||
use WebGUI::Asset;
|
||||
|
||||
use Test::More; # increment this value for each test you create
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
my $numTests = 0;
|
||||
plan tests => 2;
|
||||
|
||||
$numTests += 1; #For the use_ok
|
||||
use WebGUI::Macro::AssetProxy;
|
||||
|
||||
plan tests => $numTests;
|
||||
$session->asset(WebGUI::Asset->getDefault($session));
|
||||
|
||||
my $macro = 'WebGUI::Macro::AssetProxy';
|
||||
my $loaded = use_ok($macro);
|
||||
|
||||
SKIP: {
|
||||
|
||||
skip "Unable to load $macro", $numTests-1 unless $loaded;
|
||||
|
||||
}
|
||||
my $output;
|
||||
$output = WebGUI::Macro::AssetProxy::process($session);
|
||||
is $output, undef, 'calling AssetProxy with no identifier returns no error message in normal mode';
|
||||
|
||||
$session->var->switchAdminOn;
|
||||
$output = WebGUI::Macro::AssetProxy::process($session);
|
||||
like $output, qr/Invalid Asset URL/, '..., adminOn, return error message';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue