From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 4/7] www_coderepo: reduce utf8::decode calls
Date: Sat, 28 Jan 2023 11:02:52 +0000 [thread overview]
Message-ID: <20230128110255.2950084-5-e@80x24.org> (raw)
In-Reply-To: <20230128110255.2950084-1-e@80x24.org>
It's safe to call utf8::decode on data where "\0" exists.
---
lib/PublicInbox/WwwCoderepo.pm | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/lib/PublicInbox/WwwCoderepo.pm b/lib/PublicInbox/WwwCoderepo.pm
index 4d8713b4..8df6116a 100644
--- a/lib/PublicInbox/WwwCoderepo.pm
+++ b/lib/PublicInbox/WwwCoderepo.pm
@@ -124,7 +124,6 @@ EOM
$last = pop(@r) if scalar(@r) > $ctx->{wcr}->{summary_branches};
for (@r) {
my ($pfx, $oid, $ref, $s, $cd) = split(/\0/);
- utf8::decode($_) for ($ref, $s);
chomp $cd;
my $align = length($ref) < 12 ? ' ' x (12 - length($ref)) : '';
print $zfh "$pfx <a\nhref=./$oid/s/>", ascii_html($ref),
@@ -148,7 +147,6 @@ EOM
}
for (@r) {
my (undef, $oid, $ref, $s, $cd) = split(/\0/);
- utf8::decode($_) for ($ref, $s);
chomp $cd;
my $align = length($ref) < 12 ? ' ' x (12 - length($ref)) : '';
print $zfh "<a\nhref=./$oid/s/>", ascii_html($ref),
@@ -169,6 +167,7 @@ EOM
sub capture_refs ($$) { # psgi_qx callback to capture git-for-each-ref + git-log
my ($bref, $ctx) = @_;
my $qsp_err = delete $ctx->{-qsp_err};
+ utf8::decode($$bref);
$ctx->{-each_refs} = $$bref;
summary_finish($ctx) if $ctx->{-readme};
}
next prev parent reply other threads:[~2023-01-28 11:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-28 11:02 [PATCH 0/7] www_coderepo updates Eric Wong
2023-01-28 11:02 ` [PATCH 1/7] www_coderepo: tree: quiet and 404 on non-existent refs Eric Wong
2023-01-28 11:02 ` [PATCH 2/7] www_coderepo: support /$REPO/tags.atom endpoint Eric Wong
2023-01-28 11:02 ` [PATCH 3/7] www_coderepo: fix snapshot link generation Eric Wong
2023-01-28 11:02 ` Eric Wong [this message]
2023-01-28 11:02 ` [PATCH 5/7] repo_atom: translate: account for multiple args Eric Wong
2023-01-28 11:02 ` [PATCH 6/7] www_coderepo: support $REPO/refs/{heads,tags}/ endpoints Eric Wong
2023-01-28 11:02 ` [PATCH 7/7] www_coderepo: summary: fix mis-linkification of `...' Eric Wong
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=20230128110255.2950084-5-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.
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).