]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Inbox.pm
www_stream: fix search for new.html endpoint
[public-inbox.git] / lib / PublicInbox / Inbox.pm
index 3f1b7334f01109343a1b1723c165f6d5bbe5b299..ada713c741657ef16522d4b118cffebcbd95c4be 100644 (file)
@@ -5,7 +5,7 @@
 package PublicInbox::Inbox;
 use strict;
 use warnings;
-use Scalar::Util qw(weaken);
+use Scalar::Util qw(weaken isweak);
 use PublicInbox::Git;
 use PublicInbox::MID qw(mid2path);
 
@@ -19,7 +19,9 @@ sub new {
 
 sub weaken_all {
        my ($self) = @_;
-       weaken($self->{$_}) foreach qw(git mm search);
+       foreach my $f (qw(git mm search)) {
+               isweak($self->{$f}) or weaken($self->{$f});
+       }
 }
 
 sub git {
@@ -97,7 +99,9 @@ sub nntp_usable {
 sub msg_by_path ($$;$) {
        my ($self, $path, $ref) = @_;
        # TODO: allow other refs:
-       git($self)->cat_file('HEAD:'.$path, $ref);
+       my $str = git($self)->cat_file('HEAD:'.$path, $ref);
+       $$str =~ s/\A[\r\n]*From [^\r\n]*\r?\n//s if $str;
+       $str;
 }
 
 sub msg_by_mid ($$;$) {