NetReader->add_url supports URI-like objects, now. We'll be
relying on the canonicalization for LeiSavedSearch.
$self->{base_type} = 'mbox';
} elsif ($fmt =~ /\Aimaps?\z/) { # TODO .onion support
require PublicInbox::NetWriter;
$self->{base_type} = 'mbox';
} elsif ($fmt =~ /\Aimaps?\z/) { # TODO .onion support
require PublicInbox::NetWriter;
+ require PublicInbox::URIimap;
my $net = PublicInbox::NetWriter->new;
my $net = PublicInbox::NetWriter->new;
$net->{quiet} = $lei->{opt}->{quiet};
$net->{quiet} = $lei->{opt}->{quiet};
- my $err = $net->errors($dst);
+ my $uri = PublicInbox::URIimap->new($dst)->canonical;
+ $net->add_url($uri);
+ my $err = $net->errors;
return $lei->fail($err) if $err;
return $lei->fail($err) if $err;
- require PublicInbox::URIimap; # TODO: URI cast early
- $self->{uri} = PublicInbox::URIimap->new($dst);
- $self->{uri}->mailbox or die "No mailbox: $dst";
+ $uri->mailbox or return $lei->fail("No mailbox: $dst");
+ $self->{uri} = $uri;
+ $dst = $lei->{ovv}->{dst} = $$uri; # canonicalized
$lei->{net} = $net;
$self->{base_type} = 'imap';
} else {
$lei->{net} = $net;
$self->{base_type} = 'imap';
} else {