user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
* [PATCH] searchidx: do not modify read-only $1 via git_unquote
@ 2019-12-15  3:37 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2019-12-15  3:37 UTC (permalink / raw)
  To: meta

git_unquote works in-place, and we sometimes see strange
filenames, or badly munged diffs with terminal escape
characters (for colorization) end up in emails.
---
 lib/PublicInbox/SearchIdx.pm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm
index f265fa7f..926fac80 100644
--- a/lib/PublicInbox/SearchIdx.pm
+++ b/lib/PublicInbox/SearchIdx.pm
@@ -204,11 +204,13 @@ sub index_diff ($$$) {
 			$in_diff = $self->index_old_diff_fn(\%seen, $fa, $fb,
 							$xnq);
 		} elsif (m!^--- ("?a/.+)!) {
-			my $fn = (split('/', git_unquote($1), 2))[1];
+			my $fn = $1;
+			$fn = (split('/', git_unquote($fn), 2))[1];
 			$seen{$fn}++ or $self->index_diff_inc($fn, 'XDFN', $xnq);
 			$in_diff = 1;
 		} elsif (m!^\+\+\+ ("?b/.+)!)  {
-			my $fn = (split('/', git_unquote($1), 2))[1];
+			my $fn = $1;
+			$fn = (split('/', git_unquote($fn), 2))[1];
 			$seen{$fn}++ or $self->index_diff_inc($fn, 'XDFN', $xnq);
 			$in_diff = 1;
 		} elsif (/^--- (\S+)/) {

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

only message in thread, other threads:[~2019-12-15  3:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-15  3:37 [PATCH] searchidx: do not modify read-only $1 via git_unquote Eric Wong

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