]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 553923: Don't word-wrap messages and errors for the WebService
authorMax Kanat-Alexander <mkanat@bugzilla.org>
Sun, 28 Mar 2010 21:25:08 +0000 (14:25 -0700)
committerMax Kanat-Alexander <mkanat@bugzilla.org>
Sun, 28 Mar 2010 21:25:08 +0000 (14:25 -0700)
r=dkl, a=mkanat

Bugzilla/Template.pm

index 68ab2a8b374bca8e7add280c0d005b2079999728..10a4963c22f22cbda3914dd34c77289e3aacc8c9 100644 (file)
@@ -669,10 +669,18 @@ sub create {
                 $var =~ s/\&gt;/>/g;
                 $var =~ s/\&quot;/\"/g;
                 $var =~ s/\&amp;/\&/g;
-                # Now remove extra whitespace, and wrap it to 72 characters.
+                # Now remove extra whitespace...
                 my $collapse_filter = $Template::Filters::FILTERS->{collapse};
                 $var = $collapse_filter->($var);
-                $var = wrap_comment($var, 72);
+                # And if we're not in the WebService, wrap the message.
+                # (Wrapping the message in the WebService is unnecessary
+                # and causes awkward things like \n's appearing in error
+                # messages in JSON-RPC.)
+                unless (Bugzilla->usage_mode == USAGE_MODE_JSON
+                        or Bugzilla->usage_mode == USAGE_MODE_XMLRPC)
+                {
+                    $var = wrap_comment($var, 72);
+                }
                 return $var;
             },