]> Sergey Matveev's repositories - public-inbox.git/commitdiff
lei: fix mail_sync.sqlite3 folder names for NNTP
authorEric Wong <e@80x24.org>
Tue, 4 May 2021 05:24:24 +0000 (05:24 +0000)
committerEric Wong <e@80x24.org>
Tue, 4 May 2021 23:07:55 +0000 (23:07 +0000)
We should not have "SCALAR(XXXXXXX)" showing up in SQLite DBs
because we passed a SCALAR ref instead of a non-ref SCALAR.

lib/PublicInbox/NetReader.pm
t/lei-import-nntp.t

index 64910fe193eeb87275ea6f32c341077d44bf0e43..fd0d168269c25af10b9b607052eb46d59a71ea92 100644 (file)
@@ -628,6 +628,7 @@ sub _nntp_fetch_all ($$$) {
                warn "# $uri fetching ARTICLE $beg..$end\n";
        }
        my $n = $self->{max_batch};
+       my $url = $$uri;
        for ($beg..$end) {
                last if $self->{quit};
                $art = $_;
@@ -650,7 +651,7 @@ sub _nntp_fetch_all ($$$) {
                $raw = join('', @$raw);
                $raw =~ s/\r\n/\n/sg;
                my ($eml_cb, @args) = @{$self->{eml_each}};
-               $eml_cb->($uri, $art, $kw, PublicInbox::Eml->new(\$raw), @args);
+               $eml_cb->($url, $art, $kw, PublicInbox::Eml->new(\$raw), @args);
                $last_art = $art;
        }
        run_commit_cb($self);
index 12bb002aa9590ead41785f6849aca248b301d8df..662da30939fa8e2b88ee64d4b3c04a64c26ad527 100644 (file)
@@ -16,10 +16,9 @@ test_lei({ tmpdir => $tmpdir }, sub {
        lei_ok(qw(q z:1..));
        my $out = json_utf8->decode($lei_out);
        is_deeply($out, [ undef ], 'nothing imported, yet');
-       lei_ok('import', "nntp://$host_port/t.v2");
-       diag $lei_err;
+       my $url = "nntp://$host_port/t.v2";
+       lei_ok('import', $url);
        lei_ok(qw(q z:1..));
-       diag $lei_err;
        $out = json_utf8->decode($lei_out);
        ok(scalar(@$out) > 1, 'got imported messages');
        is(pop @$out, undef, 'trailing JSON null element was null');
@@ -29,5 +28,7 @@ test_lei({ tmpdir => $tmpdir }, sub {
 
        my $f = "$ENV{HOME}/.local/share/lei/store/mail_sync.sqlite3";
        ok(-s $f, 'mail_sync exists tracked for redundant imports');
+       lei_ok 'ls-mail-sync';
+       like($lei_out, qr!\A\Q$url\E\n\z!, 'ls-mail-sync output as-expected');
 });
 done_testing;