From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 717F91FA29 for ; Tue, 24 Jan 2023 09:50:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1674553804; bh=vJa729wLm11vCwbzxbMfH55Zeeb7BfTMojANrNbm5ac=; h=From:To:Subject:Date:In-Reply-To:References:From; b=NsHk5AwxYiIiZY7mEDlnc/S4itYzvcm6AtBUqc3MyLO1DMKGSaCdcg6pXGVS8Moau +EwSDDSq2VNnY9sDW2oMqEJG7JB/rb+X6Mw7d8LY4pJlqRUPmrlYqGF+kt9aRzQ5Rn AwdPXBM/GYiapPBtoEQm3i1IWlZvPWMG8U/iO76M= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 02/11] viewvcs: add path name hint based on `b=' query param Date: Tue, 24 Jan 2023 09:49:31 +0000 Message-Id: <20230124094940.572017-3-e@80x24.org> In-Reply-To: <20230124094940.572017-1-e@80x24.org> References: <20230124094940.572017-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Of course, we need a note saying it's non-authoritative since anybody can fiddle with the `b=' parameter in the URL. --- lib/PublicInbox/ViewVCS.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/PublicInbox/ViewVCS.pm b/lib/PublicInbox/ViewVCS.pm index 37b688ed..00db8ff2 100644 --- a/lib/PublicInbox/ViewVCS.pm +++ b/lib/PublicInbox/ViewVCS.pm @@ -501,8 +501,13 @@ sub solve_result { return show_tag($ctx, $res) if $type eq 'tag'; return show_other($ctx, $res) if $type ne 'blob'; my $paths = $ctx->{-paths} //= do { - my $path = to_filename($di->{path_b}//$hints->{path_b}//'blob'); + my $fn = $di->{path_b} // $hints->{path_b}; + my $path = to_filename($fn // 'blob'); my $raw_more = qq[(raw)]; + + # XXX not sure if this is the correct wording + defined($fn) and $raw_more .= +"\nname: ${\ascii_html($fn)} \t # note: path name is non-authoritative"; [ $path, $raw_more ]; };