summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Attachment.pm
diff options
context:
space:
mode:
authorMax Kanat-Alexander <mkanat@bugzilla.org>2011-02-11 01:27:18 +0100
committerMax Kanat-Alexander <mkanat@bugzilla.org>2011-02-11 01:27:18 +0100
commitcee67bdc0eff06b16f5d374be9cc6ca8961e11c4 (patch)
treef53a0654a53fa624d5e1055bb3f0a72d6782e828 /Bugzilla/Attachment.pm
parent04a0f6e7a3d58e7ea0cdcff0b547c70e46fa58fe (diff)
downloadbugzilla-cee67bdc0eff06b16f5d374be9cc6ca8961e11c4.tar.gz
bugzilla-cee67bdc0eff06b16f5d374be9cc6ca8961e11c4.tar.xz
Bug 633041: Add an error code for zero_length_file and fill in content_type
for patches when content_type is missing in Bug.add_attachment in the WebService r=LpSolit, a=LpSolit
Diffstat (limited to 'Bugzilla/Attachment.pm')
-rw-r--r--Bugzilla/Attachment.pm11
1 files changed, 8 insertions, 3 deletions
diff --git a/Bugzilla/Attachment.pm b/Bugzilla/Attachment.pm
index 0f6bf0a74..2bd5d8f3c 100644
--- a/Bugzilla/Attachment.pm
+++ b/Bugzilla/Attachment.pm
@@ -112,6 +112,10 @@ use constant VALIDATORS => {
mimetype => \&_check_content_type,
};
+use constant VALIDATOR_DEPENDENCIES => {
+ mimetype => ['ispatch'],
+};
+
use constant UPDATE_VALIDATORS => {
isobsolete => \&Bugzilla::Object::check_boolean,
};
@@ -508,9 +512,10 @@ sub _check_bug {
}
sub _check_content_type {
- my ($invocant, $content_type) = @_;
-
- $content_type = 'text/plain' if (ref $invocant && $invocant->ispatch);
+ my ($invocant, $content_type, undef, $params) = @_;
+
+ my $is_patch = ref($invocant) ? $invocant->ispatch : $params->{ispatch};
+ $content_type = 'text/plain' if $is_patch;
$content_type = trim($content_type);
my $legal_types = join('|', LEGAL_CONTENT_TYPES);
if (!$content_type or $content_type !~ /^($legal_types)\/.+$/) {