[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug#65754: gnatsweb breaks on file attachements (fwd)

From: Gerald Pfeifer
Subject: Re: Bug#65754: gnatsweb breaks on file attachements (fwd)
Date: Thu, 15 Mar 2001 23:40:02 +0100 (CET)

I just installed the following patch by Tommi, which is based on a PR
from the Debian bug tracking system. (Tommi, in case you wonder I made
the ChangeLog entry conform a bit close to the GNU Coding Standards.)



2001-03-11  Tommi Virtanen  <address@hidden>

        * (decode_attachment): Editing bugs with attached files
        used to bomb out trying to chomp a constant string.

diff -Naur gnats-3.113.orig/contrib/gnatsweb/ 
--- gnats-3.113.orig/contrib/gnatsweb/       Thu Oct 28 16:57:01 1999
+++ gnats-3.113/contrib/gnatsweb/    Sun Mar 11 12:40:59 2001
@@ -473,14 +473,15 @@
   my ($envelope, $body) = split(/\n\n/, $att);
   return $hash_ref unless ($envelope && $body);

-  # Got the idea from this from the perldoc for split.
-  # The extra map step is the only way I could think of to strip
-  # the trailing newlines from the hash values.
+  # Split mbox-like headers into (header, value) pairs, with a leading
+  # "From_" line swallowed into USELESS_LEADING_ENTRY. Junk the leading
+  # entry. Chomp all values.
   warn "decode_attachment: envelope=>$envelope<=\n" if $debug;
-  #%$hash_ref = (USELESS_LEADING_ENTRY => split /^(\S*?):\s*/m, $envelope);
-  %$hash_ref = (map {chomp; $_;}
-               (USELESS_LEADING_ENTRY => split /^(\S*?):\s*/m, $envelope));
-  delete($$hash_ref{USELESS_LEADING_ENTRY});
+  %$hash_ref = (USELESS_LEADING_ENTRY => split /^(\S*?):\s*/m, $envelope);
+  delete($hash_ref->{USELESS_LEADING_ENTRY});
+  for (keys %$hash_ref) {
+    chomp $hash_ref->{$_};
+  }

   # Keep the original_attachment intact.
   $$hash_ref{'original_attachment'} = $att;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]