]> Sergey Matveev's repositories - public-inbox.git/commitdiff
lei_input: reject --mail-sync if using HTTP(S) for now
authorEric Wong <e@80x24.org>
Sun, 2 May 2021 06:05:39 +0000 (06:05 +0000)
committerEric Wong <e@80x24.org>
Mon, 3 May 2021 18:45:25 +0000 (18:45 +0000)
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
t/lei-import-http.t

index 917f682ba97961c2d35e20935d0e8b69926fd1f9..85caac35aa24d8ab1f7d7d0e173377ca2c83ab40 100644 (file)
@@ -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;
index 35cbf3693e4dc8737ab889d82ace111accf1c0f6..6cb8a75387b26f0e93d8f03fe10e546552f3fae1 100644 (file)
@@ -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;