From 197f94c0e54d897d9e3f0e58e8627c4aea610969 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Tue, 31 May 2011 21:27:53 -0700 Subject: [PATCH] Fix gateway url handling in the RenderThingData macro. Fixes one part of #12133. --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Macro/RenderThingData.pm | 19 +++++++++++-------- t/Macro/RenderThingData.t | 14 +++++++++++++- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index c1e6c19a4..fb4106be6 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -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. diff --git a/lib/WebGUI/Macro/RenderThingData.pm b/lib/WebGUI/Macro/RenderThingData.pm index 4038d74c0..13625ff83 100644 --- a/lib/WebGUI/Macro/RenderThingData.pm +++ b/lib/WebGUI/Macro/RenderThingData.pm @@ -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