From 34b534d80c36e92cf7dda6cd64a219d33b96d7a1 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 2 May 2021 06:05:39 +0000 Subject: [PATCH] lei_input: reject --mail-sync if using HTTP(S) for now I'm not sure how we'll distinguish JMAP vs read-only HTTPS, yet; but we'll focus on currently-supported stuff, first. --- lib/PublicInbox/LeiInput.pm | 2 ++ t/lei-import-http.t | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/lib/PublicInbox/LeiInput.pm b/lib/PublicInbox/LeiInput.pm index 917f682b..85caac35 100644 --- a/lib/PublicInbox/LeiInput.pm +++ b/lib/PublicInbox/LeiInput.pm @@ -229,6 +229,8 @@ sub prepare_inputs { # returns undef on error } } } elsif ($input_path =~ m!\Ahttps?://!i) { + # TODO: how would we detect r/w JMAP? + push @{$sync->{no}}, $input if $sync; prepare_http_input($self, $lei, $input_path) or return; } elsif ($input_path =~ s/\A([a-z0-9]+)://is) { my $ifmt = lc $1; diff --git a/t/lei-import-http.t b/t/lei-import-http.t index 35cbf369..6cb8a753 100644 --- a/t/lei-import-http.t +++ b/t/lei-import-http.t @@ -39,5 +39,10 @@ test_lei({ tmpdir => $tmpdir }, sub { $res = json_utf8->decode($lei_out); is($res->[0]->{'m'}, '20180720072141.GA15957@example', 'imported search result') or diag explain($res); + + ok(!lei(qw(import --mail-sync), "$url/x\@example.com/raw"), + '--mail-sync fails on HTTP'); + diag $lei_err; + }); done_testing; -- 2.48.1