Fix gateway url handling in the RenderThingData macro. Fixes one part of #12133.
This commit is contained in:
parent
b866601efa
commit
197f94c0e5
3 changed files with 25 additions and 9 deletions
|
|
@ -6,6 +6,7 @@
|
|||
plugins to fix an Inbox security bug (and other similar potential bugs).
|
||||
- fixed #12139: break on calander feeds during upgrade
|
||||
- fixed #12136: Unable to add more than one image in Story
|
||||
- fixed #12133: RenderThingData macro doesn't accept templateId
|
||||
|
||||
7.10.17
|
||||
- fixed: Forced to use a PayDriver even with a balance of 0 in the cart.
|
||||
|
|
|
|||
|
|
@ -41,21 +41,24 @@ sub process {
|
|||
my ($session, $thingDataUrl, $templateHint ) = @_;
|
||||
my $i18n = WebGUI::International->new($session, 'Macro_RenderThingData');
|
||||
return $i18n->get('no template') if !$templateHint;
|
||||
|
||||
my $uri = URI->new( $thingDataUrl );
|
||||
|
||||
|
||||
my $gateway = $session->config->get('gateway');
|
||||
my $uri = URI->new( $thingDataUrl );
|
||||
my $thingy_url = $uri->path;
|
||||
$thingy_url =~ s/^$gateway//;
|
||||
|
||||
my $urlHash = { $uri->query_form };
|
||||
my $thingId = $urlHash->{'thingId'};
|
||||
my $thingDataId = $urlHash->{'thingDataId'};
|
||||
|
||||
my $thing = WebGUI::Asset::Wobject::Thingy->newByUrl( $session, $uri->path );
|
||||
|
||||
|
||||
my $thing = WebGUI::Asset::Wobject::Thingy->newByUrl( $session, $thingy_url );
|
||||
|
||||
# TODO: i18n
|
||||
return ( $i18n->get('bad url') . $thingDataUrl ) if !$thing || !$thingId || !$thingDataId;
|
||||
|
||||
|
||||
# Render
|
||||
my $output = $thing->www_viewThingData( $thingId, $thingDataId, $templateHint );
|
||||
|
||||
|
||||
# FIX: Temporary solution (broken map due to template rendering <script> tags)
|
||||
return $i18n->get('bad tags') if $output =~ /script>/;
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ WebGUI::Test->addToCleanup(sub {
|
|||
WebGUI::Test->unmockAssetUrl($templateUrl);
|
||||
});
|
||||
|
||||
plan tests => 4;
|
||||
plan tests => 6;
|
||||
|
||||
my $node = WebGUI::Asset->getImportNode($session);
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
|
|
@ -105,5 +105,17 @@ $templateProcessed = 0;
|
|||
|
||||
$output = WebGUI::Macro::RenderThingData::process($session, $thing_url, $templateUrl);
|
||||
ok $templateProcessed, 'passed template url, template processed';
|
||||
$templateProcessed = 0;
|
||||
|
||||
WebGUI::Test->originalConfig('gateway');
|
||||
$session->config->set('gateway', '/gated');
|
||||
my $thing_url = $thingy->getUrl('thingId='.$thingId.';thingDataId='.$thingDataId);
|
||||
|
||||
$output = WebGUI::Macro::RenderThingData::process($session, $thing_url, $templateId);
|
||||
ok $templateProcessed, 'gateway set, passed templateId, template processed';
|
||||
$templateProcessed = 0;
|
||||
|
||||
$output = WebGUI::Macro::RenderThingData::process($session, $thing_url, $templateUrl);
|
||||
ok $templateProcessed, '... passed template url, template processed';
|
||||
$templateProcessed = 0;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue