fix #10891: Change session->output->print to skip macros based on detecting the mime-type.
This commit is contained in:
parent
48be049930
commit
084da8e159
3 changed files with 13 additions and 6 deletions
|
|
@ -9,6 +9,7 @@
|
|||
- fixed #10883: Recover Password / Auth::WebGUI /getSiteUrl
|
||||
- fixed #10892: In/Out Board
|
||||
- fixed #10893: Code editor uses element-min.js
|
||||
- fixed #10891: Asset manager JSON feed has macros processed
|
||||
|
||||
7.7.19
|
||||
- fixed #10838: Forwarded forum post email to new CS adds reply to original thread
|
||||
|
|
|
|||
|
|
@ -80,15 +80,16 @@ The content to output.
|
|||
|
||||
=head3 skipMacros
|
||||
|
||||
A boolean indicating whether to skip macro processing on this content.
|
||||
A boolean indicating whether to skip macro processing on this content. If the mime type
|
||||
has been set to a non-text type, macros will automatically be skipped.
|
||||
|
||||
=cut
|
||||
|
||||
sub print {
|
||||
my $self = shift;
|
||||
my $content = shift;
|
||||
my $skipMacros = shift;
|
||||
WebGUI::Macro::process($self->session, \$content) unless $skipMacros;
|
||||
my $self = shift;
|
||||
my $content = shift;
|
||||
my $skipMacros = shift || !($self->session->http->getMimeType =~ /^text/);
|
||||
WebGUI::Macro::process($self->session, \$content) unless $skipMacros;
|
||||
my $handle = $self->{_handle};
|
||||
if (defined $handle) {
|
||||
print $handle $content;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ use WebGUI::Session;
|
|||
|
||||
use Test::More; # increment this value for each test you create
|
||||
|
||||
my $skip_tests = 7;
|
||||
my $skip_tests = 8;
|
||||
my $num_tests = 1 + $skip_tests;
|
||||
|
||||
plan tests => $num_tests;
|
||||
|
|
@ -56,6 +56,11 @@ SKIP: {
|
|||
$output->print('^#;', 1);
|
||||
like($request->get_output, qr/\^#;\Z/, 'print: macro processing skipped');
|
||||
|
||||
$session->http->setMimeType('application/json');
|
||||
$output->print('^#;');
|
||||
like($request->get_output, qr/\^#;\Z/, 'print: macro processing skipped');
|
||||
|
||||
$session->http->setMimeType('');
|
||||
$output->setHandle($otherHandle);
|
||||
$output->print('New content');
|
||||
is($otherHandleBuffer, 'New content', 'print: set to explicit handle');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue