user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH] viewdiff: fix parts of diff being appended after signature
Date: Sun,  2 Oct 2022 15:11:01 +0000	[thread overview]
Message-ID: <20221002151101.6681-1-e@80x24.org> (raw)

I'm not sure what kind of brain fart introduced this in
c1e7a048be9d32cd, but it happened :x.  We'll undef the $x
variable ASAP to save memory and make future errors like this
one more noticeable.

Fixes: c1e7a048be9d ("www: viewdiff: fix UTF-8 names inside mbox attachments")
---
 lib/PublicInbox/ViewDiff.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/PublicInbox/ViewDiff.pm b/lib/PublicInbox/ViewDiff.pm
index 95bbf2d2..124a723a 100644
--- a/lib/PublicInbox/ViewDiff.pm
+++ b/lib/PublicInbox/ViewDiff.pm
@@ -212,8 +212,9 @@ sub flush_diff ($$) {
 			for my $s (split(/((?:(?:^\+[^\n]*\n)+)|
 					(?:(?:^-[^\n]*\n)+)|
 					(?:^@@ [^\n]+\n))/xsm, $x)) {
+				undef $x;
 				if (!defined($dctx)) {
-					print $afh $x;
+					print $afh $s;
 				} elsif ($s =~ s/\A@@ (\S+) (\S+) @@//) {
 					print $zfh qq(<span\nclass="hunk">),
 						diff_hunk($dctx, $1, $2),

                 reply	other threads:[~2022-10-02 15:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221002151101.6681-1-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

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