diff options
author | Eric Wong <e@80x24.org> | 2021-03-19 10:35:56 -0200 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-03-19 12:46:56 +0000 |
commit | f7af186cf033daae8947f3368378e07ee116bb9c (patch) | |
tree | 113c38592bea11322eee07c49bf98fdbe37aa83e /lib/PublicInbox | |
parent | 30a997d856baec0c73acc376f4a872917cbfed28 (diff) | |
download | public-inbox-f7af186cf033daae8947f3368378e07ee116bb9c.tar.gz |
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'")
Diffstat (limited to 'lib/PublicInbox')
-rw-r--r-- | lib/PublicInbox/LeiExternal.pm | 5 | ||||
-rw-r--r-- | lib/PublicInbox/LeiXSearch.pm | 2 |
2 files changed, 7 insertions, 0 deletions
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); diff --git a/lib/PublicInbox/LeiXSearch.pm b/lib/PublicInbox/LeiXSearch.pm index 22c8026c..d95a218e 100644 --- a/lib/PublicInbox/LeiXSearch.pm +++ b/lib/PublicInbox/LeiXSearch.pm @@ -502,8 +502,10 @@ sub prepare_external { return add_uri($self, URI->new($loc)); } elsif (-f "$loc/ei.lock") { require PublicInbox::ExtSearch; + die "`\\n' not allowed in `$loc'\n" if index($loc, "\n") >= 0; $loc = PublicInbox::ExtSearch->new($loc); } elsif (-f "$loc/inbox.lock" || -d "$loc/public-inbox") { + die "`\\n' not allowed in `$loc'\n" if index($loc, "\n") >= 0; require PublicInbox::Inbox; # v2, v1 $loc = bless { inboxdir => $loc }, 'PublicInbox::Inbox'; } else { |