diff options
author | Eric Wong <e@80x24.org> | 2016-05-19 02:42:05 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2016-05-19 20:53:11 +0000 |
commit | 78042ed9abb2bbe9783adcc485365a8672e4b36f (patch) | |
tree | a1d1a8d539827d8ace692222c8c6f21a6fd8fb40 /lib/PublicInbox/WWW.pm | |
parent | 21a5cfeb30afef90ca888d425b62651466eed9e3 (diff) | |
download | public-inbox-78042ed9abb2bbe9783adcc485365a8672e4b36f.tar.gz |
This can be useful for lists where the convention is to attach (rather than inline) patches into the message body.
Diffstat (limited to 'lib/PublicInbox/WWW.pm')
-rw-r--r-- | lib/PublicInbox/WWW.pm | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/PublicInbox/WWW.pm b/lib/PublicInbox/WWW.pm index 465dcb26..f87f4171 100644 --- a/lib/PublicInbox/WWW.pm +++ b/lib/PublicInbox/WWW.pm @@ -23,6 +23,7 @@ use PublicInbox::GitHTTPBackend; our $INBOX_RE = qr!\A/([\w\.\-]+)!; our $MID_RE = qr!([^/]+)!; our $END_RE = qr!(T/|t/|R/|t\.mbox(?:\.gz)?|t\.atom|raw|)!; +our $ATTACH_RE = qr!(\d[\.\d]*)-([\w-]+\.[a-z0-9]+)!i; sub new { my ($class, $pi_config) = @_; @@ -73,6 +74,10 @@ sub call { } elsif ($path_info =~ m!$INBOX_RE/$MID_RE/$END_RE\z!o) { msg_page($self, $ctx, $1, $2, $3); + } elsif ($path_info =~ m!$INBOX_RE/$MID_RE/$ATTACH_RE\z!o) { + my ($idx, $fn) = ($3, $4); + invalid_inbox_mid($self, $ctx, $1, $2) || + get_attach($ctx, $idx, $fn); # in case people leave off the trailing slash: } elsif ($path_info =~ m!$INBOX_RE/$MID_RE/(T|t|R)\z!o) { my ($inbox, $mid, $suffix) = ($1, $2, $3); @@ -442,4 +447,10 @@ sub news_www { $self->{news_www} = PublicInbox::NewsWWW->new($self->{pi_config}); } +sub get_attach { + my ($ctx, $idx, $fn) = @_; + require PublicInbox::WwwAttach; + PublicInbox::WwwAttach::get_attach($ctx, $idx, $fn); +} + 1; |