From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-3.9 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 322CD1F93C for ; Mon, 28 Nov 2022 05:32:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1669613569; bh=fSMlAFqHy2ASVvqDQO1/cbTvrftmQucKhTUSlNEyvAE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=LJ39J+1fLh7ReMPZUayXqvzW8EvuK5APOlp+uxbg7CwDZCPJPgzqH+oe1tzvkP0xm ZLnbNpVesaeCUa5zJN09iDa4IE01fnm0t9yEt4SDT/Z/6YLRvda4anql5gNg37/2mH mnKIRiotYGWT+6zrz4tjytecKQ71JONROAxTHttQ= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 77/95] lei_mirror: respect `./' and `../' prefixes for CLI args Date: Mon, 28 Nov 2022 05:32:14 +0000 Message-Id: <20221128053232.291618-78-e@80x24.org> In-Reply-To: <20221128053232.291618-1-e@80x24.org> References: <20221128053232.291618-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: 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 | 12 ++++++------ lib/PublicInbox/LeiMirror.pm | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) 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 = {};