From f7af186cf033daae8947f3368378e07ee116bb9c Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 19 Mar 2021 10:35:56 -0200 Subject: lei: disallow "\n" in local externals paths git 2.11 and earlier could not handle git directories with newlines in them, nor does libgit2 support them. Followup-to: d87dd0e679587043 ("config: reject `\n' in `inboxdir'") --- lib/PublicInbox/LeiExternal.pm | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/PublicInbox/LeiExternal.pm') diff --git a/lib/PublicInbox/LeiExternal.pm b/lib/PublicInbox/LeiExternal.pm index 47791d4e..b5dd85e1 100644 --- a/lib/PublicInbox/LeiExternal.pm +++ b/lib/PublicInbox/LeiExternal.pm @@ -170,9 +170,14 @@ sub lei_add_external { $self->fail(<<""); # TODO: did you mean "update-external?" --mirror destination `$location' already exists + } elsif (-d $location) { + index($location, "\n") >= 0 and + return $self->fail("`\\n' not allowed in `$location'"); } if ($location !~ m!\Ahttps?://! && !-d $location) { $mirror // return $self->fail("$location not a directory"); + index($location, "\n") >= 0 and + return $self->fail("`\\n' not allowed in `$location'"); $mirror = ext_canonicalize($mirror); require PublicInbox::LeiMirror; PublicInbox::LeiMirror->start($self, $mirror => $location); -- cgit v1.2.3-24-ge0c7