aboutsummaryrefslogtreecommitdiff
blob: e0726b9c92423a9070896c8dd1708783daf7d060 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# -*- Mode: perl; indent-tabs-mode: nil -*-
#
# This extension is filtering attachments.
#
# Currently its is filtering html attachments.
#
# Contributor(s):
#   Max Magorsch <arzano@gentoo.org>

package Bugzilla::Extension::AttachmentFilter;
use strict;
use base qw(Bugzilla::Extension);
use Bugzilla::Error;

our $VERSION = '0.01';
################################################################################
# This extension is filtering attachments. Currently its is filtering html
# attachments.
################################################################################
sub attachment_process_data {
  my ($self, $args) = @_;
  return unless ( ($args->{attributes}->{mimetype} eq 'text/html') or ($args->{attributes}->{filename} =~ /\.htm\z/) or ($args->{attributes}->{filename} =~ /\.html\z/) );

  ${$args->{data}} = '';
  $args->{attributes}->{filename} = '';

  ThrowUserError("illegal_html_attachment");
}

__PACKAGE__->NAME;