]> Sergey Matveev's repositories - public-inbox.git/commitdiff
mbox: show application/mbox for obfuscated inboxes
authorEric Wong <e@80x24.org>
Fri, 23 Jun 2017 03:39:08 +0000 (03:39 +0000)
committerEric Wong <e@80x24.org>
Fri, 23 Jun 2017 03:39:08 +0000 (03:39 +0000)
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

index 2565ea58a07d327b94c8947ceb705427c17fc0fb..88daba752153385ed74656cae0699078a65139c3 100644 (file)
@@ -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 {