From 971d73458f19eb7d1a3600ee7bfd11b16cbc698a Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Wed, 6 Sep 2006 01:54:05 +0000 Subject: Bug 349764: Errors print out a whole HTML page, even when we're not in USAGE_MODE_BROWSER Patch By Max Kanat-Alexander r=kevin.benton, a=myk --- Bugzilla/CGI.pm | 11 +++++++---- template/en/default/global/code-error.html.tmpl | 6 ++---- template/en/default/global/user-error.html.tmpl | 6 ++---- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/Bugzilla/CGI.pm b/Bugzilla/CGI.pm index 39c812551..b78c077e9 100644 --- a/Bugzilla/CGI.pm +++ b/Bugzilla/CGI.pm @@ -37,6 +37,7 @@ use CGI qw(-no_xhtml -oldstyle_urls :private_tempfiles :unique_headers SERVER_PU use base qw(CGI); +use Bugzilla::Constants; use Bugzilla::Error; use Bugzilla::Util; @@ -61,10 +62,12 @@ sub new { my $self = $class->SUPER::new(@args); - # This happens here so that command-line scripts don't spit out - # their errors in HTML format. - require CGI::Carp; - import CGI::Carp qw(fatalsToBrowser); + if (Bugzilla->error_mode eq ERROR_MODE_WEBPAGE) { + # This happens here so that command-line scripts don't spit out + # their errors in HTML format. + require CGI::Carp; + import CGI::Carp qw(fatalsToBrowser); + } # Make sure our outgoing cookie list is empty on each invocation $self->{Bugzilla_cookie_list} = []; diff --git a/template/en/default/global/code-error.html.tmpl b/template/en/default/global/code-error.html.tmpl index d5c5766b0..27798491b 100644 --- a/template/en/default/global/code-error.html.tmpl +++ b/template/en/default/global/code-error.html.tmpl @@ -393,11 +393,9 @@ [% END %] [% END %] -[%# If we are in ERROR_MODE_DIE, we want the error message to be plain text, - # not HTML -%] +[%# We only want HTML error messages for ERROR_MODE_WEBPAGE %] [% USE Bugzilla %] -[% IF Bugzilla.error_mode == ERROR_MODE_DIE %] +[% IF Bugzilla.error_mode != ERROR_MODE_WEBPAGE %] [% error_message FILTER none %] [% RETURN %] [% END %] diff --git a/template/en/default/global/user-error.html.tmpl b/template/en/default/global/user-error.html.tmpl index c696989f2..7885abd38 100644 --- a/template/en/default/global/user-error.html.tmpl +++ b/template/en/default/global/user-error.html.tmpl @@ -1475,11 +1475,9 @@ [% END %] [% END %] -[%# If we are in ERROR_MODE_DIE, we want the error message to be plain text, - # not HTML -%] +[%# We only want HTML error messages for ERROR_MODE_WEBPAGE %] [% USE Bugzilla %] -[% IF Bugzilla.error_mode == ERROR_MODE_DIE %] +[% IF Bugzilla.error_mode != ERROR_MODE_WEBPAGE %] [% error_message FILTER none %] [% RETURN %] [% END %] -- cgit v1.2.3-24-g4f1b