Commit cee67bdc authored by Max Kanat-Alexander's avatar Max Kanat-Alexander

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
parent 04a0f6e7
......@@ -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)\/.+$/) {
......
......@@ -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>
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment