]> Sergey Matveev's repositories - public-inbox.git/commitdiff
clone: canonicalize destination path from CLI
authorEric Wong <e@80x24.org>
Mon, 28 Nov 2022 05:32:09 +0000 (05:32 +0000)
committerEric Wong <e@80x24.org>
Mon, 28 Nov 2022 23:38:58 +0000 (23:38 +0000)
We'll probably save the destination path somewhere, so
ensure the path doesn't have redundant slashes and such

script/public-inbox-clone

index a11c68744014ab8ebb06df6bebd77a0864ceaca6..9a22fa2166a9269907386b4a09c50a064acd4594 100755 (executable)
@@ -37,6 +37,7 @@ defined($dst) or ($dst) = ($url =~ m!/([^/]+)/?\z!);
 index($dst, "\n") >= 0 and die "`\\n' not allowed in `$dst'";
 
 # n.b. this is still a truckload of code...
+require File::Spec;
 require PublicInbox::LEI;
 require PublicInbox::LeiExternal;
 require PublicInbox::LeiMirror;
@@ -51,7 +52,7 @@ open $lei->{3}, '.' or die "open . $!";
 my $mrr = bless {
        lei => $lei,
        src => $url,
-       dst => $dst,
+       dst => File::Spec->canonpath($dst),
 }, 'PublicInbox::LeiMirror';
 
 $? = 0;