From 6a0a324f2dd354c17ccc7a97604c5b1e17bea18e Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 23 Jan 2021 10:27:55 +0000 Subject: lei add-external: don't allow non-existent directories At least not yet, though we may support mirroring via git. --- lib/PublicInbox/LeiExternal.pm | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib') 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 -- cgit v1.2.3-24-ge0c7