Closed Bug 1026400 Opened 11 years ago Closed 11 years ago

id, attachment.id, attachment.bug_id are returned as strings, not integers

Categories

(bugzilla.mozilla.org :: Extensions, defect)

Production
x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: glob, Assigned: glob)

References

Details

Attachments

(1 file, 2 obsolete files)

id, attachment.id, attachment.bug_id are returned as strings, not integers: "attachments": [ { "is_private": false, "ref": "http://bz/880669/bzapi/attachment/8340780", "bug_id": "880669", "last_change_time": "2014-06-17T08:09:10Z", "description": "[Bug 731601] rwasdf.eml", "size": 11, "attacher": { "real_name": "Byron Jones ‹:glob›", "name": "glob" }, "content_type": "text/plain", "file_name": "file_880669.txt", "is_patch": false, "id": "8340780", "creation_time": "2014-06-17T08:09:10Z", "bug_ref": "http://bz/880669/bzapi/bug/880669", "is_obsolete": false } ], here's data::dumper's view of $result just prior to json encoding in bugzilla/webservice/server/rest.pm: 'attachments' => [ { 'is_private' => bless( do{\(my $o = 0)}, 'JSON::XS::Boolean' ), 'ref' => 'http://bz/880669/bzapi/attachment/8340780', 'bug_id' => 880669, 'last_change_time' => '2014-06-17T08:09:10Z', 'description' => '[Bug 731601] rwasdf.eml', 'size' => 11, 'attacher' => { 'real_name' => "Byron Jones \x{2039}:glob\x{203a}", 'name' => 'glob' }, 'content_type' => 'text/plain', 'file_name' => 'file_880669.txt', 'is_patch' => $VAR1->{'attachments'}[0]{'is_private'}, 'id' => 8340780, 'creation_time' => '2014-06-17T08:09:10Z', 'bug_ref' => 'http://bz/880669/bzapi/bug/880669', 'is_obsolete' => $VAR1->{'attachments'}[0]{'is_private'} } ], looks like we're doing the right thing.
Assignee: nobody → glob
Attached patch 1026400_1.patch (obsolete) — Splinter Review
Attachment #8441388 - Flags: review?(dkl)
Comment on attachment 8441388 [details] [diff] [review] 1026400_1.patch missed the top-level "id" field
Attachment #8441388 - Attachment is obsolete: true
Attachment #8441388 - Flags: review?(dkl)
Attached patch 1026400_2.patch (obsolete) — Splinter Review
Attachment #8441402 - Flags: review?(dkl)
Comment on attachment 8441402 [details] [diff] [review] 1026400_2.patch Review of attachment 8441402 [details] [diff] [review]: ----------------------------------------------------------------- r=dkl with fix on commit ::: extensions/BzAPI/lib/Util.pm @@ +120,4 @@ > my $attachments = $rpc->attachments($attachment_params); > > my @fixed_attachments; > + foreach my $attachment (@{ $attachments->{bugs}->{int($data->{id})} }) { Just use $bug->id in place of $data->{id} in the relevant places in fix_bug()
Attachment #8441402 - Flags: review?(dkl) → review+
Comment on attachment 8441402 [details] [diff] [review] 1026400_2.patch Review of attachment 8441402 [details] [diff] [review]: ----------------------------------------------------------------- You should be able to use $object in fix_attachment() actually so do that instead. Still r=dkl with fix on commit. ::: extensions/BzAPI/lib/Util.pm @@ +120,4 @@ > my $attachments = $rpc->attachments($attachment_params); > > my @fixed_attachments; > + foreach my $attachment (@{ $attachments->{bugs}->{int($data->{id})} }) { Just use $bug->id in place of $data->{id} in the relevant places in fix_bug() @@ +255,4 @@ > > if ($data->{attachment_id} && $method ne 'Bug.search') { > $data->{attachment_ref} = $rpc->type('string', ref_urlbase() . > + "/attachment/" . int($data->{attachment_id})); Actually it is also safe to just use $object->id here. @@ +322,4 @@ > } > > if (exists $data->{bug_id}) { > + $data->{bug_ref} = $rpc->type('string', ref_urlbase() . "/bug/" . int($data->{bug_id})); $object->bug_id @@ +347,4 @@ > delete $data->{flags}; > } > > + $data->{ref} = $rpc->type('string', ref_urlbase() . "/attachment/" . int($data->{id})); $object->id
Attached patch 1026400_3.patchSplinter Review
Attachment #8441402 - Attachment is obsolete: true
Attachment #8441839 - Flags: review?(dkl)
Comment on attachment 8441839 [details] [diff] [review] 1026400_3.patch Review of attachment 8441839 [details] [diff] [review]: ----------------------------------------------------------------- Works well. r=dkl
Attachment #8441839 - Flags: review?(dkl) → review+
To ssh://gitolite3@git.mozilla.org/webtools/bmo/bugzilla.git 324f00d..d83e1be master -> master
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Probably any case where comments are included? _all is also affected: https://bugzilla.mozilla.org/bzapi/bug?id=1026400&include_fields=_all
thanks kohei. please file new bugs for issues, instead of re-opening bugs that have been marked as fixed. re-opening bugs makes tracking fixes difficult if a different person addresses the new issue. thanks!
Status: REOPENED → RESOLVED
Closed: 11 years ago11 years ago
Resolution: --- → FIXED
(filed as bug 1027060)
Component: Extensions: BzAPI Compatibility → Extensions
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: