summaryrefslogtreecommitdiffstats
path: root/Bugzilla/WebService
diff options
context:
space:
mode:
authorDave Lawrence <dlawrence@mozilla.com>2013-09-26 23:26:53 +0200
committerDave Lawrence <dlawrence@mozilla.com>2013-09-26 23:26:53 +0200
commit5d0e6171ebce1410aedb378aa64e65abbcf916eb (patch)
treeadd09a5df4d36a2d0e01f243a21906eaf4c77661 /Bugzilla/WebService
parent0bb48df63d01216e295140adb3642333c0767c67 (diff)
downloadbugzilla-5d0e6171ebce1410aedb378aa64e65abbcf916eb.tar.gz
bugzilla-5d0e6171ebce1410aedb378aa64e65abbcf916eb.tar.xz
Bug 917483 - Bug.update_attachment causes error when updating filename using key 'file_name'
Diffstat (limited to 'Bugzilla/WebService')
-rw-r--r--Bugzilla/WebService/Bug.pm25
1 files changed, 19 insertions, 6 deletions
diff --git a/Bugzilla/WebService/Bug.pm b/Bugzilla/WebService/Bug.pm
index eaca97f91..250284d61 100644
--- a/Bugzilla/WebService/Bug.pm
+++ b/Bugzilla/WebService/Bug.pm
@@ -17,7 +17,7 @@ use Bugzilla::Constants;
use Bugzilla::Error;
use Bugzilla::Field;
use Bugzilla::WebService::Constants;
-use Bugzilla::WebService::Util qw(filter filter_wants validate);
+use Bugzilla::WebService::Util qw(filter filter_wants validate translate);
use Bugzilla::Bug;
use Bugzilla::BugMail;
use Bugzilla::Util qw(trick_taint trim diff_arrays);
@@ -55,6 +55,20 @@ use constant READ_ONLY => qw(
search
);
+use constant ATTACHMENT_MAPPED_SETTERS => {
+ file_name => 'filename',
+ summary => 'description',
+};
+
+use constant ATTACHMENT_MAPPED_RETURNS => {
+ description => 'summary',
+ ispatch => 'is_patch',
+ isprivate => 'is_private',
+ isobsolete => 'is_obsolete',
+ filename => 'file_name',
+ mimetype => 'content_type',
+};
+
######################################################
# Add aliases here for old method name compatibility #
######################################################
@@ -751,9 +765,8 @@ sub update_attachment {
# We can't update flags, and summary is really description
delete $params->{flags};
- if (exists $params->{summary}) {
- $params->{description} = delete $params->{summary};
- }
+
+ $params = translate($params, ATTACHMENT_MAPPED_SETTERS);
# Get all the attachments, after verifying that they exist and are editable
my @attachments = ();
@@ -782,6 +795,8 @@ sub update_attachment {
foreach my $attachment (@attachments) {
my $changes = $attachment->update();
+ $changes = translate($changes, ATTACHMENT_MAPPED_RETURNS);
+
my %hash = (
id => $self->type('int', $attachment->id),
last_change_time => $self->type('dateTime', $attachment->modification_time),
@@ -790,8 +805,6 @@ sub update_attachment {
foreach my $field (keys %$changes) {
my $change = $changes->{$field};
- # Description is shown as summary to the user
- $field = 'summary' if $field eq 'description';
# We normalize undef to an empty string, so that the API
# stays consistent for things like Deadline that can become