public inbox for gnats-devel@sourceware.org
 help / color / mirror / Atom feed
* Re: Bug#65754: gnatsweb breaks on file attachements (fwd)
@ 2001-03-15 14:40 Gerald Pfeifer
  0 siblings, 0 replies; only message in thread
From: Gerald Pfeifer @ 2001-03-15 14:40 UTC (permalink / raw)
  To: gnats-devel; +Cc: Tommi Virtanen

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.)

Thanks!

Gerald

2001-03-11  Tommi Virtanen  <tv@debian.org>

        * gnatsweb.pl (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/gnatsweb.pl gnats-3.113/contrib/gnatsweb/gnatsweb.pl
--- gnats-3.113.orig/contrib/gnatsweb/gnatsweb.pl	Thu Oct 28 16:57:01 1999
+++ gnats-3.113/contrib/gnatsweb/gnatsweb.pl	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;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-03-15 14:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-03-15 14:40 Bug#65754: gnatsweb breaks on file attachements (fwd) Gerald Pfeifer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).