]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 633041: Add an error code for zero_length_file and fill in content_type
authorMax Kanat-Alexander <mkanat@bugzilla.org>
Fri, 11 Feb 2011 00:27:18 +0000 (16:27 -0800)
committerMax Kanat-Alexander <mkanat@bugzilla.org>
Fri, 11 Feb 2011 00:27:18 +0000 (16:27 -0800)
for patches when content_type is missing in Bug.add_attachment in the
WebService
r=LpSolit, a=LpSolit

Bugzilla/Attachment.pm
Bugzilla/WebService/Bug.pm
Bugzilla/WebService/Constants.pm

index 0f6bf0a74c106d8775cb8ad3fc70597af6476857..2bd5d8f3cf3778f113154e7a31e7af7384473a4b 100644 (file)
@@ -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)\/.+$/) {
index 822730e4a924db2773d04afbb85bd90c269a438b..189c984c3e860dcb422b230ec9d465fadbbd50f8 100644 (file)
@@ -2446,6 +2446,10 @@ You did not specify a valid for the C<file_name> argument.
 
 You did not specify a value for the C<summary> argument.
 
+=item 606 (Empty Data)
+
+You set the "data" field to an empty string.
+
 =back
 
 =item B<History>
index e2c0a0f52d11a9dc9b605538868df26e1ffdbb28..0adb190ec77b90462372861927f087b637c2b2cd 100644 (file)
@@ -148,6 +148,7 @@ use constant WS_ERROR_CODE => {
     file_not_specified     => 603,
     missing_attachment_description => 604,
     # Error 605 attachment_url_disabled no longer exists.
+    zero_length_file       => 606,
 
     # Errors thrown by the WebService itself. The ones that are negative 
     # conform to http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php