]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 157074 - verify-new-product doubles comment linefeeds on Win32
authorbbaetz%student.usyd.edu.au <>
Fri, 19 Jul 2002 21:04:08 +0000 (21:04 +0000)
committerbbaetz%student.usyd.edu.au <>
Fri, 19 Jul 2002 21:04:08 +0000 (21:04 +0000)
r=myk, jouni

checksetup.pl
globals.pl
process_bug.cgi
t/004template.t
template/en/default/global/hidden-fields.html.tmpl

index f3827575422cd882ee8534ddfc395504bceaa296..8c5b7ea1ffed2a3310fc18d12751d4e8fa9dd106 100755 (executable)
@@ -891,6 +891,7 @@ END
          strike => sub { return $_; } ,
          js => sub { return $_; },
          html => sub { return $_; },
+         html_linebreak => sub { return $_; },
          url_quote => sub { return $_; },
         },
       }) || die ("Could not create Template: " . Template->error() . "\n");
index aeaaca25f6f562a8506fd0f6da03d3260b8f0a91..115efcc645d62381831db8fd1c58d7dc6c8378f5 100644 (file)
@@ -1563,6 +1563,20 @@ $::template ||= Template->new(
         
         html => \&html_quote , 
 
+        # HTML collapses newlines in element attributes to a single space,
+        # so form elements which may have whitespace (ie comments) need
+        # to be encoded using &#013;
+        # See bugs 4928, 22983 and 32000 for more details
+        html_linebreak => sub
+        {
+            my ($var) = @_;
+            $var =~ s/\r\n/\&#013;/g;
+            $var =~ s/\n\r/\&#013;/g;
+            $var =~ s/\r/\&#013;/g;
+            $var =~ s/\n/\&#013;/g;
+            return $var;
+        } ,
+
         # This subroutine in CGI.pl escapes characters in a variable
         # or value string for use in a query string.  It escapes all
         # characters NOT in the regex set: [a-zA-Z0-9_\-.].  The 'uri'
index 103085457f70b456c9ec6ca20e11cd5c10723747..5482a1ad23a25808ea718fdab8707a9ea144298b 100755 (executable)
@@ -882,9 +882,6 @@ foreach my $id (@idlist) {
 
         $vars->{'start_at'} = $::FORM{'longdesclength'};
         $vars->{'comments'} = GetComments($id);
-        
-        $::FORM{'comment'} =~ s/\r\n/\n/g;     # Get rid of windows-style line endings.
-        $::FORM{'comment'} =~ s/\r/\n/g;       # Get rid of mac-style line endings.
 
         $::FORM{'delta_ts'} = $delta_ts;
         $vars->{'form'} = \%::FORM;
index ba50c1e66cd27d382ecefe9b263a522a6993e0fe..730aafc8626e1d97eb149a1904bdd67481a6e956 100644 (file)
@@ -77,6 +77,7 @@ my $template = Template->new(
     # See globals.pl for the actual codebase definitions.
     FILTERS =>
     {
+        html_linebreak => sub { return $_; },
         js        => sub { return $_ } ,
         strike    => sub { return $_ } ,
         url_quote => sub { return $_ } ,
index 76040bea1b1a178c2d57faf47644d6fefd298bc7..25c6b048f5480b5d1ff7cae84a9989a9212172f8 100644 (file)
@@ -28,5 +28,6 @@
 [%# Generate hidden form fields for non-excluded fields. %]
 [% FOREACH field = form %]
   [% NEXT IF exclude && field.key.search(exclude) %]
-  <input type="hidden" name="[% field.key %]" value="[% field.value FILTER html %]">
+  <input type="hidden" name="[% field.key %]"
+         value="[% field.value | html | html_newline %]">
 [% END %]