unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
* [PATCH] search_query: drop CR (`\r') from queries
@ 2024-12-09 20:57 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2024-12-09 20:57 UTC (permalink / raw)
  To: meta

w3m (and presumably other browsers) send CRLF instead of LF for
queries made from <textarea> from the VCS view.  CRs require
unnecessary escaping and make RLs look ugly, so omit them
to cleanup URLs and reduce memory traffic in Xapian.
---
 lib/PublicInbox/SearchQuery.pm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/PublicInbox/SearchQuery.pm b/lib/PublicInbox/SearchQuery.pm
index 747e3249..e0127dea 100644
--- a/lib/PublicInbox/SearchQuery.pm
+++ b/lib/PublicInbox/SearchQuery.pm
@@ -17,8 +17,10 @@ sub new {
 	my ($l) = (($qp->{l} || '') =~ /([0-9]+)/);
 	$l = $LIM if !$l || $l > $LIM;
 	my ($o) = (($qp->{o} || '0') =~ /(-?[0-9]+)/);
+	my $q = $qp->{'q'};
+	$q =~ s/\r\n/\n/sg if defined $q;
 	bless {
-		q => $qp->{'q'},
+		q => $q,
 		x => $qp->{x} || '',
 		o => $o,
 		l => $l,

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

only message in thread, other threads:[~2024-12-09 20:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-09 20:57 [PATCH] search_query: drop CR (`\r') from queries Eric Wong

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