]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 349764: Errors print out a whole HTML page, even when we're not in USAGE_MODE_BROWSER
authormkanat%bugzilla.org <>
Wed, 6 Sep 2006 01:54:05 +0000 (01:54 +0000)
committermkanat%bugzilla.org <>
Wed, 6 Sep 2006 01:54:05 +0000 (01:54 +0000)
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=kevin.benton, a=myk

Bugzilla/CGI.pm
template/en/default/global/code-error.html.tmpl
template/en/default/global/user-error.html.tmpl

index 39c81255123ada70ae21cdb975629a8c942f0a3b..b78c077e9ed0dc544bcbaefb9f70b2e1ed7dbd01 100644 (file)
@@ -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} = [];
index d5c5766b0974ae9597f8faa3bc6fa38cf05885d1..27798491bb40761fd9bbbdf14f25a84aae47c92d 100644 (file)
   [% 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 %]
index c696989f2286a26213c1e9a0480b32d15f79e547..7885abd384f6a0114fdbb590c8a79574fd2b66c7 100644 (file)
   [% 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 %]