]> Sergey Matveev's repositories - public-inbox.git/commitdiff
lei_mirror: respect `./' and `../' prefixes for CLI args
authorEric Wong <e@80x24.org>
Mon, 28 Nov 2022 05:32:14 +0000 (05:32 +0000)
committerEric Wong <e@80x24.org>
Mon, 28 Nov 2022 23:38:58 +0000 (23:38 +0000)
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.

Documentation/public-inbox-clone.pod
lib/PublicInbox/LeiMirror.pm

index 5e6a6fe92f4322c9448cb3a0b0765d53dcc3b585..9bcb9967a38e9079295f739bdf227223d64605ec 100644 (file)
@@ -89,9 +89,9 @@ for testing.
 Enables space savings when the remote C<manifest.js.gz>
 includes C<forkgroup> entries as generated by grokmirror 2.x.
 
-If C<DIR> is not an absolute path, it is relative to the
-C<DESTINATION> directory.  If only C<--objstore=> is specified
-where C<DIR> is an empty string (C<"">), then C<objstore>
+If C<DIR> does not start with C</>, C<./>, or C<../>, it is treated
+as relative to the C<DESTINATION> directory.  If only C<--objstore=>
+is specified where C<DIR> is an empty string (C<"">), then C<objstore>
 (C<$DESTINATION/objstore>) is the implied value of C<DIR>.
 
 =item --manifest=FILE
@@ -99,9 +99,9 @@ where C<DIR> is an empty string (C<"">), then C<objstore>
 When incrementally updating an existing mirror, load the given
 manifest (typically C<manifest.js.gz>) to speed up updates.
 
-If C<FILE> is not an absolute path, it is relative to the
-C<DESTINATION> directory.  If only C<--manifest => is specified
-where C<FILE > is an empty string (C<"">), then C<manifest.js.gz>
+If C<FILE> does not start with C</>, C<./>, or C<../>, it is treated
+as relative to the C<DESTINATION> directory.  If only C<--manifest=>
+is specified where C<FILE> is an empty string (C<"">), then C<manifest.js.gz>
 (C<$DESTINATION/manifest.js.gz>) is the implied value of C<FILE>.
 
 =item -p
index e0a212dede3268f1b87a5348fcbdcf292ec1fac6..ec2ed557e7d13b32cbf9263ff20cce709e43166f 100644 (file)
@@ -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 = {};