-
- # Check that the attachment matches the configured
- # pagespec.
- my $result=pagespec_match($filename, $config{valid_attachments},
- tempfile => $tempfile);
- if (! $result) {
- error(gettext("attachment rejected")." ($result)");
+
+ # Use a pagespec to test that the attachment is valid.
+ if (exists $config{valid_attachments} &&
+ length $config{valid_attachments}) {
+ my $result=pagespec_match($filename, $config{valid_attachments},
+ file => $tempfile);
+ if (! $result) {
+ error(gettext("attachment rejected")." ($result)");
+ }