]>
git.proxmox.com Git - pmg-api.git/blob - PMG/RuleDB/ArchiveFilter.pm
1 package PMG
::RuleDB
::ArchiveFilter
;
10 use PMG
::RuleDB
::ContentTypeFilter
;
12 use base
qw(PMG::RuleDB::ContentTypeFilter);
19 return 'Archive Filter';
23 'proxmox/unreadable-archive' => undef,
27 my ($type, $fvalue, $ogroup) = @_;
29 my $class = ref($type) || $type;
31 my $self = $class->SUPER::new
($fvalue, $ogroup);
37 my ($type, $ruledb, $id, $ogroup, $value) = @_;
39 my $class = ref($type) || $type;
41 my $obj = $class->SUPER::load_attr
($ruledb, $id, $ogroup, $value);
47 my ($self, $entity) = @_;
51 # match subtypes? We currently do exact matches only.
53 if (my $id = $entity->head->mime_attr ('x-proxmox-tmp-aid')) {
56 my $header_ct = $entity->head->mime_attr ('content-type');
58 my $magic_ct = $entity->{PMX_magic_ct
};
60 my $glob_ct = $entity->{PMX_glob_ct
};
62 if ($header_ct && $header_ct =~ m
|$self->{field_value
}|) {
64 } elsif ($magic_ct && $magic_ct =~ m
|$self->{field_value
}|) {
66 } elsif ($glob_ct && $glob_ct =~ m
|$self->{field_value
}|) {
69 # match inside archives
70 if (my $cts = $entity->{PMX_content_types
}) {
71 foreach my $ct (keys %$cts) {
72 if ($ct =~ m
|$self->{field_value
}|) {
81 foreach my $part ($entity->parts) {
82 if (my $match = $self->parse_entity ($part)) {
91 my ($self, $queue, $entity, $msginfo) = @_;
93 return $self->parse_entity ($entity);
100 =head1 PMG::RuleDB::ArchiveFilter
102 Content type filter for Archives