]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/WWW.pm
feed: various object-orientation cleanups
[public-inbox.git] / lib / PublicInbox / WWW.pm
index c25deff3117dfe576ec33719b4bc2cc17befbf20..f1f4abd5f86d517383683bb67fc989fdcd3f0c0e 100644 (file)
@@ -15,6 +15,7 @@ use strict;
 use warnings;
 use Plack::Request;
 use PublicInbox::Config;
+use PublicInbox::Hval;
 use URI::Escape qw(uri_escape_utf8 uri_unescape);
 use constant SSOMA_URL => '//ssoma.public-inbox.org/';
 use constant PI_URL => '//public-inbox.org/';
@@ -46,6 +47,7 @@ sub call {
        # we don't care about multi-value
        my %qp = map {
                my ($k, $v) = split('=', $_, 2);
+               $v = '' unless defined $v;
                ($k, $v)
        } split(/[&;]/, uri_unescape($env->{QUERY_STRING}));
        $ctx->{qp} = \%qp;
@@ -204,9 +206,7 @@ sub get_index {
 # just returns a string ref for the blob in the current ctx
 sub mid2blob {
        my ($ctx) = @_;
-       require PublicInbox::MID;
-       my $path = PublicInbox::MID::mid2path($ctx->{mid});
-       $ctx->{git}->cat_file("HEAD:$path");
+       $ctx->{-inbox}->msg_by_mid($ctx->{mid});
 }
 
 # /$INBOX/$MESSAGE_ID/raw                    -> raw mbox
@@ -255,6 +255,7 @@ sub footer {
 
        # auto-generate a footer
        chomp(my $desc = $obj->description);
+       $desc = PublicInbox::Hval::ascii_html($desc);
 
        my $urls;
        my @urls = @{$obj->cloneurl};