Bug 427914
Summary: | XMLRPC function addAttachment | ||||||
---|---|---|---|---|---|---|---|
Product: | [Community] Bugzilla | Reporter: | Noura El hawary <nelhawar> | ||||
Component: | WebService | Assignee: | David Lawrence <dkl> | ||||
Status: | CLOSED NEXTRELEASE | QA Contact: | |||||
Severity: | medium | Docs Contact: | |||||
Priority: | high | ||||||
Version: | 3.2 | ||||||
Target Milestone: | --- | ||||||
Target Release: | --- | ||||||
Hardware: | All | ||||||
OS: | Linux | ||||||
Whiteboard: | |||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2008-09-22 14:48:12 UTC | Type: | --- | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Bug Depends On: | |||||||
Bug Blocks: | 406131, 427053 | ||||||
Attachments: |
|
Description
Noura El hawary
2008-01-08 02:03:55 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 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 |