about summary refs log tree commit homepage
path: root/lib/PublicInbox/WwwAttach.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-06-20 00:57:16 +0000
committerEric Wong <e@80x24.org>2016-06-20 00:57:38 +0000
commit4b313dc74bc9bb84a542b7ec920cdb92879e7523 (patch)
treebdea400b15979d0d4206aa8aa840c71ed956eaca /lib/PublicInbox/WwwAttach.pm
parent2724361ab69cd071c970c66e076784c582c76e42 (diff)
downloadpublic-inbox-4b313dc74bc9bb84a542b7ec920cdb92879e7523.tar.gz
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.
Diffstat (limited to 'lib/PublicInbox/WwwAttach.pm')
-rw-r--r--lib/PublicInbox/WwwAttach.pm5
1 files changed, 1 insertions, 4 deletions
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]};