@@ -311,8 +311,9 @@ sub exportAsHtml {
311
311
312
312
sub exportBranch {
313
313
my ($self , $options , $reportSession ) = @_ ;
314
+ my $session = $self -> session;
314
315
my $i18n = $reportSession &&
315
- WebGUI::International-> new($self -> session, ' Asset' );
316
+ WebGUI::International-> new($session , ' Asset' );
316
317
317
318
my $depth = $options -> {depth };
318
319
my $indexFileName = $options -> {indexFileName };
@@ -361,13 +362,22 @@ sub exportBranch {
361
362
my $exportAsset = sub {
362
363
my ( $assetId ) = @_ ;
363
364
# Must be created once for each asset, since session is supposed to only handle
364
- # one main asset
365
- my $outputSession = $self -> session-> duplicate;
365
+ # one main asset. It also cannot be a clone of the current session, since when
366
+ # this duplicate is closed it will overwrite the scratch from the original
367
+ my $outputSession = WebGUI::Session-> open (
368
+ $session -> config-> getWebguiRoot,
369
+ $session -> config-> getFilename,
370
+ );
371
+ $outputSession -> user( { userId => $session -> user-> getId } );
372
+ $outputSession -> scratch-> set(' isExporting' , 1);
373
+ $outputSession -> scratch-> set(' exportUrl' ,$session -> scratch-> get(' exportUrl' ));
374
+ $outputSession -> style-> setMobileStyle($session -> style-> useMobileStyle?1:0);
366
375
my $osGuard = Scope::Guard-> new(sub {
367
376
$outputSession -> close ;
368
377
$outputSession = undef ;
369
378
});
370
379
380
+
371
381
my $asset = WebGUI::Asset-> new($outputSession , $assetId );
372
382
my $fullPath = $asset -> exportGetUrlAsPath;
373
383
0 commit comments