summaryrefslogtreecommitdiffstats
path: root/Bugzilla/WebService/Server/JSONRPC.pm
diff options
context:
space:
mode:
authorMax Kanat-Alexander <mkanat@bugzilla.org>2010-07-14 00:43:40 +0200
committerMax Kanat-Alexander <mkanat@bugzilla.org>2010-07-14 00:43:40 +0200
commit12eb7b79859d1ee0be9f237d2b097fc4bf42d2c3 (patch)
treee4c668cbd0942de49a14d84a1f06ea13a94b3061 /Bugzilla/WebService/Server/JSONRPC.pm
parente0ee27cff75e9803d026e817439d55221992c493 (diff)
downloadbugzilla-12eb7b79859d1ee0be9f237d2b097fc4bf42d2c3.tar.gz
bugzilla-12eb7b79859d1ee0be9f237d2b097fc4bf42d2c3.tar.xz
Bug 412074: Ability to add attachments to a bug via the WebService
(Bug.add_attachment) r=timello, a=mkanat
Diffstat (limited to 'Bugzilla/WebService/Server/JSONRPC.pm')
-rw-r--r--Bugzilla/WebService/Server/JSONRPC.pm14
1 files changed, 13 insertions, 1 deletions
diff --git a/Bugzilla/WebService/Server/JSONRPC.pm b/Bugzilla/WebService/Server/JSONRPC.pm
index 5ab5e4a7b..3ff875361 100644
--- a/Bugzilla/WebService/Server/JSONRPC.pm
+++ b/Bugzilla/WebService/Server/JSONRPC.pm
@@ -27,9 +27,10 @@ use base qw(JSON::RPC::Server::CGI Bugzilla::WebService::Server);
use Bugzilla::Error;
use Bugzilla::WebService::Constants;
use Bugzilla::WebService::Util qw(taint_data);
-
use Bugzilla::Util qw(correct_urlbase trim);
+use MIME::Base64 qw(decode_base64);
+
#####################################
# Public JSON::RPC Method Overrides #
#####################################
@@ -326,6 +327,12 @@ sub _argument_type_check {
}
}
}
+ my @base64_fields = @{ $pkg->BASE64_FIELDS->{$method} || [] };
+ foreach my $field (@base64_fields) {
+ if (defined $params->{$field}) {
+ $params->{$field} = decode_base64($params->{$field});
+ }
+ }
Bugzilla->input_params($params);
@@ -503,6 +510,11 @@ to be fully safe for forward-compatibility with all future versions of
Bugzilla, it is safest to pass in all times as UTC with the "Z" timezone
specifier.)
+C<base64> fields are strings that have been base64 encoded. Note that
+although normal base64 encoding includes newlines to break up the data,
+newlines within a string are not valid JSON, so you should not insert
+newlines into your base64-encoded string.
+
All other types are standard JSON types.
=head1 ERRORS