From 4b313dc74bc9bb84a542b7ec920cdb92879e7523 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 20 Jun 2016 00:57:16 +0000 Subject: feed: various object-orientation cleanups Favor Inbox objects as our primary source of truth to simplify our code. This increases our coupling with PSGI to make it easier to write tests in the future. A lot of this code was originally designed to be usable standalone without PSGI or CGI at all; but that might increase development effort. --- lib/PublicInbox/WwwAttach.pm | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'lib/PublicInbox/WwwAttach.pm') diff --git a/lib/PublicInbox/WwwAttach.pm b/lib/PublicInbox/WwwAttach.pm index 5cf56a80..33bfce27 100644 --- a/lib/PublicInbox/WwwAttach.pm +++ b/lib/PublicInbox/WwwAttach.pm @@ -8,16 +8,13 @@ use warnings; use Email::MIME; use Email::MIME::ContentType qw(parse_content_type); $Email::MIME::ContentType::STRICT_PARAMS = 0; -use PublicInbox::MID qw(mid2path); use PublicInbox::MsgIter; # /$LISTNAME/$MESSAGE_ID/$IDX-$FILENAME sub get_attach ($$$) { my ($ctx, $idx, $fn) = @_; - my $path = mid2path($ctx->{mid}); - my $res = [ 404, [ 'Content-Type', 'text/plain' ], [ "Not found\n" ] ]; - my $mime = $ctx->{git}->cat_file("HEAD:$path") or return $res; + my $mime = $ctx->{-inbox}->msg_by_mid($ctx->{mid}) or return $res; $mime = Email::MIME->new($mime); msg_iter($mime, sub { my ($part, $depth, @idx) = @{$_[0]}; -- cgit v1.2.3-24-ge0c7