user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 10/10] lei add-external: don't allow non-existent directories
  2021-01-23 10:27  6% [PATCH 00/10] lei: externals more stuff Eric Wong
@ 2021-01-23 10:27  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2021-01-23 10:27 UTC (permalink / raw)
  To: meta

At least not yet, though we may support mirroring via git.
---
 lib/PublicInbox/LeiExternal.pm | 3 +++
 t/lei.t                        | 4 ++++
 2 files changed, 7 insertions(+)

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
diff --git a/t/lei.t b/t/lei.t
index 6b45f5b7..60ca75c5 100644
--- a/t/lei.t
+++ b/t/lei.t
@@ -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) = @_;

^ permalink raw reply related	[relevance 7%]

* [PATCH 00/10] lei: externals more stuff
@ 2021-01-23 10:27  6% Eric Wong
  2021-01-23 10:27  7% ` [PATCH 10/10] lei add-external: don't allow non-existent directories Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2021-01-23 10:27 UTC (permalink / raw)
  To: meta

I don't know what I'm doing anymore, and maybe I never did.

Eric Wong (10):
  lei: move external vivification to xsearch
  lei: support remote externals
  lei_to_mail: drop cyclic reference if not using IPC
  lei: oneshot: preserve stdout if writing mbox
  lei: default "-f $mfolder" args for common MUAs
  lei completion: handle URLs with port numbers
  lei forget-external: just show the location
  lei q: support a bunch of curl(1) options
  lei forget-external: do not show redundant "not found" lines
  lei add-external: don't allow non-existent directories

 lib/PublicInbox/LEI.pm         |  46 +++++++----
 lib/PublicInbox/LeiExternal.pm |  41 ++++++++--
 lib/PublicInbox/LeiOverview.pm |  10 ++-
 lib/PublicInbox/LeiQuery.pm    |  68 ++++++++++++-----
 lib/PublicInbox/LeiToMail.pm   |  24 ++++--
 lib/PublicInbox/LeiXSearch.pm  | 136 ++++++++++++++++++++++++++++-----
 lib/PublicInbox/ProcessPipe.pm |   2 +
 script/lei                     |   2 +
 t/lei.t                        |  43 +++++++++++
 t/lei_xsearch.t                |   5 +-
 10 files changed, 309 insertions(+), 68 deletions(-)

^ permalink raw reply	[relevance 6%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2021-01-23 10:27  6% [PATCH 00/10] lei: externals more stuff Eric Wong
2021-01-23 10:27  7% ` [PATCH 10/10] lei add-external: don't allow non-existent directories Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).