]> 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:28:31 +0000 (16:28 -0800)
committerMax Kanat-Alexander <mkanat@bugzilla.org>
Fri, 11 Feb 2011 00:28:31 +0000 (16:28 -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 adc6ddcf2c424643f05efe01acb56750dfb1e8d9..79f7b915e4baf6186ffb61b447b176347a8fd081 100644 (file)
@@ -111,6 +111,10 @@ use constant VALIDATORS => {
     store_in_file => \&_check_store_in_file,
 };
 
+use constant VALIDATOR_DEPENDENCIES => {
+    mimetype => ['ispatch', 'isurl'],
+};
+
 use constant UPDATE_VALIDATORS => {
     filename   => \&_check_filename,
     isobsolete => \&Bugzilla::Object::check_boolean,
@@ -523,9 +527,15 @@ sub _check_bug {
 }
 
 sub _check_content_type {
-    my ($invocant, $content_type) = @_;
+    my ($invocant, $content_type, undef, $params) = @_;
+
+    my ($is_url, $is_patch) = @$params{qw(isurl ispatch)};
+    if (ref $invocant) {
+        $is_url = $invocant->isurl;
+        $is_patch = $invocant->ispatch;
+    }
 
-    $content_type = 'text/plain' if (ref $invocant && ($invocant->isurl || $invocant->ispatch));
+    $content_type = 'text/plain' if ($is_url || $is_patch);
     $content_type = trim($content_type);
     my $legal_types = join('|', LEGAL_CONTENT_TYPES);
     if (!$content_type or $content_type !~ /^($legal_types)\/.+$/) {
index 43719f9930292a03446b7d1d2105e2f373a8743f..8bec9630464820376244908bb6e8f0200ab51ac3 100644 (file)
@@ -2463,6 +2463,10 @@ You did not specify a value for the C<summary> argument.
 You attempted to attach a URL, setting C<is_url> to True,
 but this Bugzilla does not support attaching URLs.
 
+=item 606 (Empty Data)
+
+You set the "data" field to an empty string.
+
 =back
 
 =back
index 8fbc7c09794fbc20fd2358e45e0c547211cae235..ac4aa712eb8c4510c8770ba8471b9fab49bbfa00 100644 (file)
@@ -150,6 +150,7 @@ use constant WS_ERROR_CODE => {
     file_not_specified     => 603,
     missing_attachment_description => 604,
     attachment_url_disabled => 605,
+    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