diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 8fdf70c19..e0fb96ac1 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -14,6 +14,7 @@ - fixed: Cache's setByHTTP method returns content, even when it gets an error in the request. This gives the SC asset fits. - fixed #12349: Friends invitation error - fixed #12353: Dataform List mode + - fixed #12364: Site export loses session info 7.10.24 - fixed #12318: asset error causes asset manager to fail diff --git a/lib/WebGUI/AssetExportHtml.pm b/lib/WebGUI/AssetExportHtml.pm index ffeb9af7b..73cc234f8 100644 --- a/lib/WebGUI/AssetExportHtml.pm +++ b/lib/WebGUI/AssetExportHtml.pm @@ -311,8 +311,9 @@ sub exportAsHtml { sub exportBranch { my ($self, $options, $reportSession) = @_; + my $session = $self->session; my $i18n = $reportSession && - WebGUI::International->new($self->session, 'Asset'); + WebGUI::International->new($session, 'Asset'); my $depth = $options->{depth}; my $indexFileName = $options->{indexFileName}; @@ -361,13 +362,22 @@ sub exportBranch { my $exportAsset = sub { my ( $assetId ) = @_; # Must be created once for each asset, since session is supposed to only handle - # one main asset - my $outputSession = $self->session->duplicate; + # one main asset. It also cannot be a clone of the current session, since when + # this duplicate is closed it will overwrite the scratch from the original + my $outputSession = WebGUI::Session->open( + $session->config->getWebguiRoot, + $session->config->getFilename, + ); + $outputSession->user( { userId => $session->user->getId } ); + $outputSession->scratch->set('isExporting', 1); + $outputSession->scratch->set('exportUrl',$session->scratch->get('exportUrl')); + $outputSession->style->setMobileStyle($session->style->useMobileStyle?1:0); my $osGuard = Scope::Guard->new(sub { $outputSession->close; $outputSession = undef; }); + my $asset = WebGUI::Asset->new($outputSession, $assetId); my $fullPath = $asset->exportGetUrlAsPath;