# Copyright (C) 2021 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
# Copyright (C) 2021 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
# but no Content-Length or "From " escaping.
# "git format-patch" also generates such files by default.
$buf =~ s/\A[\r\n]*From [^\r\n]*\r?\n//s;
# but no Content-Length or "From " escaping.
# "git format-patch" also generates such files by default.
$buf =~ s/\A[\r\n]*From [^\r\n]*\r?\n//s;
+
+ # a user may feed just a body: git diff | lei rediff -U9
+ if ($self->{-force_eml}) {
+ my $eml = PublicInbox::Eml->new($buf);
+ substr($buf, 0, 0) = "\n\n" if !$eml->{bdy};
+ }
$self->input_eml_cb(PublicInbox::Eml->new(\$buf), @args);
} else {
# prepare_inputs already validated $ifmt
$self->input_eml_cb(PublicInbox::Eml->new(\$buf), @args);
} else {
# prepare_inputs already validated $ifmt
my ($fh, $pid) = popen_rd($cmd, undef, $rdr);
grep(/\A--compressed\z/, @$curl) or
$fh = IO::Uncompress::Gunzip->new($fh, MultiStream => 1);
my ($fh, $pid) = popen_rd($cmd, undef, $rdr);
grep(/\A--compressed\z/, @$curl) or
$fh = IO::Uncompress::Gunzip->new($fh, MultiStream => 1);
- eval {
- PublicInbox::MboxReader->mboxrd($fh,
- $self->can('input_mbox_cb'),
- $self, @args);
- };
+ eval { $self->input_fh('mboxrd', $fh, $url, @args) };
- if ($sync) {
- if ($input =~ m!\Aimaps?://!) {
- push @{$sync->{ok}}, $input;
- } else {
- push @{$sync->{no}}, $input;
- }
- }
- } elsif ($input_path =~ m!\Ahttps?://!i) {
+ push @{$sync->{ok}}, $input if $sync;
+ } elsif ($input_path =~ m!\Ahttps?://!i) { # mboxrd.gz
# TODO: how would we detect r/w JMAP?
push @{$sync->{no}}, $input if $sync;
prepare_http_input($self, $lei, $input_path) or return;
# TODO: how would we detect r/w JMAP?
push @{$sync->{no}}, $input if $sync;
prepare_http_input($self, $lei, $input_path) or return;
- if ($sync) {
- if ($ifmt =~ /\A(?:maildir|mh)\z/i) {
- push @{$sync->{ok}}, $input;
- } else {
- push @{$sync->{no}}, $input;
- }
+ if ($ifmt =~ /\A(?:maildir|mh)\z/i) {
+ push @{$sync->{ok}}, $input if $sync;
+ } else {
+ push @{$sync->{no}}, $input if $sync;
lc($in_fmt//'eml') eq 'eml' or return $lei->fail(<<"");
$input is `eml', not --in-format=$in_fmt
lc($in_fmt//'eml') eq 'eml' or return $lei->fail(<<"");
$input is `eml', not --in-format=$in_fmt