From: Eric Wong Date: Mon, 28 Nov 2022 05:32:14 +0000 (+0000) Subject: lei_mirror: respect `./' and `../' prefixes for CLI args X-Git-Url: http://www.git.stargrave.org/?p=public-inbox.git;a=commitdiff_plain;h=464c28e42bbbe54fc1d13629258eff31ecfc1689 lei_mirror: respect `./' and `../' prefixes for CLI args Users may wish to keep objstore and manifest files at a higher level to prevent direct access via HTTP(S), so those relative paths probably make sense. --- diff --git a/Documentation/public-inbox-clone.pod b/Documentation/public-inbox-clone.pod index 5e6a6fe9..9bcb9967 100644 --- a/Documentation/public-inbox-clone.pod +++ b/Documentation/public-inbox-clone.pod @@ -89,9 +89,9 @@ for testing. Enables space savings when the remote C includes C entries as generated by grokmirror 2.x. -If C is not an absolute path, it is relative to the -C directory. If only C<--objstore=> is specified -where C is an empty string (C<"">), then C +If C does not start with C, C<./>, or C<../>, it is treated +as relative to the C directory. If only C<--objstore=> +is specified where C is an empty string (C<"">), then C (C<$DESTINATION/objstore>) is the implied value of C. =item --manifest=FILE @@ -99,9 +99,9 @@ where C is an empty string (C<"">), then C When incrementally updating an existing mirror, load the given manifest (typically C) to speed up updates. -If C is not an absolute path, it is relative to the -C directory. If only C<--manifest => is specified -where C is an empty string (C<"">), then C +If C does not start with C, C<./>, or C<../>, it is treated +as relative to the C directory. If only C<--manifest=> +is specified where C is an empty string (C<"">), then C (C<$DESTINATION/manifest.js.gz>) is the implied value of C. =item -p diff --git a/lib/PublicInbox/LeiMirror.pm b/lib/PublicInbox/LeiMirror.pm index e0a212de..ec2ed557 100644 --- a/lib/PublicInbox/LeiMirror.pm +++ b/lib/PublicInbox/LeiMirror.pm @@ -1055,7 +1055,7 @@ sub do_mirror { # via wq_io_do or public-inbox-clone my ($k) = (split(/\./, $default))[0]; my $v = $lei->{opt}->{$k} // next; $v = $default if $v eq ''; - $v = "$self->{dst}/$v" if $v !~ m!\A/!; + $v = "$self->{dst}/$v" if $v !~ m!\A\.{0,2}/!; $self->{"-$k"} = $v; } local $LIVE = {};