]> Sergey Matveev's repositories - public-inbox.git/commitdiff
net_reader: quote URL properly for Tor .onion hint
authorEric Wong <e@80x24.org>
Sat, 18 Sep 2021 21:09:14 +0000 (21:09 +0000)
committerEric Wong <e@80x24.org>
Sun, 19 Sep 2021 00:04:13 +0000 (00:04 +0000)
The semicolon in ';AUTH=ANONYMOUS' requires quoting in Bourne shell.

lib/PublicInbox/NetReader.pm

index ccfdd26194a3f3056266411b70edb5a3441c1452..30b8f810d8fd4fa17653733536973446d022ddee 100644 (file)
@@ -71,19 +71,21 @@ sub onion_hint ($$) {
        my ($lei, $uri) = @_;
        $uri->host =~ /\.onion\z/i or return "\n";
        my $t = $uri->isa('PublicInbox::URIimap') ? 'imap' : 'nntp';
-       my $url = uri_section($uri);
+       my $url = PublicInbox::Config::squote_maybe(uri_section($uri));
        my $set_cfg = 'lei config';
        if (!$lei) { # public-inbox-watch
-               my $f = $ENV{PI_CONFIG} || '~/.public-inbox/config';
+               my $f = PublicInbox::Config::squote_maybe(
+                               $ENV{PI_CONFIG} || '~/.public-inbox/config');
                $set_cfg = "git config -f $f";
        }
+       my $dq = substr($url, 0, 1) eq "'" ? '"' : '';
        <<EOM
 
 Assuming you have Tor configured and running locally on port 9050,
 try configuring a socks5h:// proxy:
 
        url=$url
-       $set_cfg $t.\$url.proxy socks5h://127.0.0.1:9050
+       $set_cfg $t.$dq\$url$dq.proxy socks5h://127.0.0.1:9050
 
 ...before retrying your current command
 EOM