Bug 427914 - XMLRPC function addAttachment
Summary: XMLRPC function addAttachment
Alias: None
Product: Bugzilla
Classification: Community
Component: WebService   
(Show other bugs)
Version: 3.2
Hardware: All
OS: Linux
medium vote
Target Milestone: ---
Assignee: David Lawrence
QA Contact:
Depends On:
Blocks: 406131 427053
TreeView+ depends on / blocked
Reported: 2008-01-08 02:03 UTC by Noura El hawary
Modified: 2013-06-24 04:18 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2008-09-22 14:48:12 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Patch to add bugzilla.addAttachment functionality to bz 3.2 (v1) (10.90 KB, patch)
2008-09-19 19:13 UTC, David Lawrence
nelhawar: review+
Details | Diff

Description Noura El hawary 2008-01-08 02:03:55 UTC
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

Comment 1 David Lawrence 2008-09-19 19:13:30 UTC
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

Comment 2 Noura El hawary 2008-09-21 15:45:30 UTC
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)\/.+$/ ) {
                           { contenttype => $contenttype });


Comment 3 David Lawrence 2008-09-22 14:48:12 UTC
Thanks Noura. Made the changes you suggested and checked in.


Note You need to log in before you can comment on or make changes to this bug.