diff options
-rw-r--r-- | lib/PublicInbox/LeiExternal.pm | 3 | ||||
-rw-r--r-- | t/lei.t | 4 |
2 files changed, 7 insertions, 0 deletions
diff --git a/lib/PublicInbox/LeiExternal.pm b/lib/PublicInbox/LeiExternal.pm index e7693e09..bf07c41c 100644 --- a/lib/PublicInbox/LeiExternal.pm +++ b/lib/PublicInbox/LeiExternal.pm @@ -58,6 +58,9 @@ sub lei_add_external { my $cfg = $self->_lei_cfg(1); my $new_boost = $self->{opt}->{boost} // 0; $location = _canonicalize($location); + if ($location !~ m!\Ahttps?://! && !-d $location) { + return $self->fail("$location not a directory"); + } my $key = "external.$location.boost"; my $cur_boost = $cfg->{$key}; return if defined($cur_boost) && $cur_boost == $new_boost; # idempotent @@ -193,6 +193,10 @@ my $test_external = sub { ok(!-e $config_file && !-e $store_dir, 'nothing created by ls-external'); + ok(!$lei->('add-external', "$home/nonexistent"), + "fails on non-existent dir"); + $lei->('ls-external'); + is($out.$err, '', 'ls-external still has no output'); my $cfg = PublicInbox::Config->new; $cfg->each_inbox(sub { my ($ibx) = @_; |