write xmlrpc function addAttachment that is to be contributed to the upstream. Please refer to the following url for details on Bugzilla::RPC 2.18 functions mapped to upstream Bugzilla::WebService and for 2.18 xmlrpc functions sorted by percentage of calls: https://engineering.redhat.com/trac/bugzilla-3.0-rh/wiki/XmlrpcCrossComparison#a2.18xmlrpcfunctionssortedbypercentageofcalls
Created attachment 317227 [details] Patch to add bugzilla.addAttachment functionality to bz 3.2 (v1) Patch attached that ports bugzilla.addAttachment() from 2.18 to 3.2. Please review Thanks Dave
Comment on attachment 317227 [details] Patch to add bugzilla.addAttachment functionality to bz 3.2 (v1) Hi Dave, The function looks good to me and works nicely only 2 points listed below: >Index: extensions/compat_xmlrpc/code/webservice.pl >=================================================================== >+sub addAttachment { >+ my ($self, $bug_id, $data, $username, $password) = @_; >+ my $dbh = Bugzilla->dbh; >+ my $user = Bugzilla->user; >+ >+ # Try to login if $username and $password provided. >+ xmlrpc_client_login($username, $password, LOGIN_REQUIRED); >+ my $user = Bugzilla->user; ==> this should be here or otherwise if the user uses the function parameters to login the function will fail. >+ >+ # Set the content type to text/plain if the attachment is a patch. >+ my $contenttype = $ispatch ? "text/plain" : $data->{'contenttype'}; >+ $contenttype || ThrowUserError("missing_content_type"); >+ also shall we throw an error in the case of invalid contenttype just as how the webui does as the following from Bugzilla/Attachment.pm: if ( $contenttype !~ /^(application|audio|image|message|model|multipart|text|video)\/.+$/ ) { ThrowUserError("invalid_content_type", { contenttype => $contenttype }); } Thanks, Noura
Thanks Noura. Made the changes you suggested and checked in. Dave