From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 159D52082E; Fri, 23 Jun 2017 03:41:28 +0000 (UTC) Date: Fri, 23 Jun 2017 03:41:28 +0000 From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 3/1] mbox: show application/mbox for obfuscated inboxes Message-ID: <20170623034128.GA30418@dcvr> References: <20170623023402.3638-1-e@80x24.org> <20170623023433.GA4155@dcvr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170623023433.GA4155@dcvr> List-Id: Sigh, yet another place to handle obfuscation for misguided people who expect it. Maybe this will do something to prevent spammers from getting addresses, while still allowing the "curl $URL | git am" use case to work. --- lib/PublicInbox/Mbox.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/Mbox.pm b/lib/PublicInbox/Mbox.pm index 2565ea5..88daba7 100644 --- a/lib/PublicInbox/Mbox.pm +++ b/lib/PublicInbox/Mbox.pm @@ -12,8 +12,12 @@ require Email::Simple; sub emit1 { my ($ctx, $msg) = @_; $msg = Email::Simple->new($msg); - # single message should be easily renderable in browsers - [200, ['Content-Type', 'text/plain'], [ msg_str($ctx, $msg)] ] + + # single message should be easily renderable in browsers, + # unless obfuscation is enabled :< + [ 200, [ 'Content-Type', + $ctx->{-inbox}->{obfuscate} ? 'application/mbox' : 'text/plain' ], + [ msg_str($ctx, $msg)] ] } sub msg_str { -- :<