Closed
Bug 640756
Opened 14 years ago
Closed 12 years ago
Make the documentation clearer that attachments created with Bug.add_attachment must be of type 'base64'
Categories
(Bugzilla :: WebService, defect)
Tracking
()
RESOLVED
FIXED
Bugzilla 4.0
People
(Reporter: bugzilla, Assigned: justdave)
References
Details
Attachments
(1 file, 2 obsolete files)
469 bytes,
patch
|
LpSolit
:
review+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; da-dk) AppleWebKit/533.19.4 (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4
Build Identifier: 4.0
When an attachment is made, it is required to send base64 encoded data to the server (XMLRPC). However, that data does not get decoded before it is put into the database.
Attached is patch that fixes this issue.
Reproducible: Always
Steps to Reproduce:
1. Add an attachment through web services (Fx. a png)
2. Try to download the png through the web interface. It won't work, since it is still base64 encoded.
3.
Actual Results:
Attachments through the webservices are invalid.
Expected Results:
Attachments through the web services are valid.
Patch attached
![]() |
Reporter | |
Comment 1•14 years ago
|
||
![]() |
||
Comment 2•14 years ago
|
||
Seems valid to me. From what I can see, JSONRPC is working fine, but XMLRPC isn't.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: blocking4.0.1+
Summary: When creating attachment through web services, content is not decoded from base63 → When creating attachment through web services, content is not decoded from base64
Target Milestone: --- → Bugzilla 4.0
Version: unspecified → 4.0
![]() |
||
Comment 3•14 years ago
|
||
Comment on attachment 518505 [details] [diff] [review]
Patch that fixes the base64 decoding issue.
You are sending your data as a <string> instead of as a <base64>.
Attachment #518505 -
Flags: review-
![]() |
||
Comment 4•14 years ago
|
||
You must send your data with the appropriate XML-RPC datatype.
Status: NEW → RESOLVED
Closed: 14 years ago
Flags: blocking4.0.1+ → blocking4.0.1-
Resolution: --- → INVALID
Target Milestone: Bugzilla 4.0 → ---
![]() |
||
Comment 5•14 years ago
|
||
(In reply to comment #4)
> You must send your data with the appropriate XML-RPC datatype.
In that case, webservice_bug_add_attachment.t is wrong too, because the encoded data is inserted into the DB. Attachments are unreadable. So either there is a real bug, or the QA script must be fixed, in which case we can morphe this bug summary.
Status: RESOLVED → REOPENED
Resolution: INVALID → ---
![]() |
Reporter | |
Comment 6•14 years ago
|
||
Well, it worked by changing the datatype to base64 - I mistakenly just encoded it as base64, so I guess it was a misinterpretation on my part. Sorry for the false alarm.
But yes, I discovered it by noticing that the base64 data was inserted into the database, and thus unreadable for the client. I think some input validation would be a good idea, so that bugzilla-webservices-newbees like me get an error instead of grey hairs :)
![]() |
||
Comment 7•14 years ago
|
||
(In reply to comment #5)
> In that case, webservice_bug_add_attachment.t is wrong too, because the encoded
> data is inserted into the DB. Attachments are unreadable.
Are you sure? That test inserts random characters that would look much like base64. If it really is doing that (which I don't think it is, since it validates the returned data in both XML-RPC and JSON-RPC) then file a separate bug about it.
(In reply to comment #6)
> I think some input validation would be a good idea, so that bugzilla-
> webservices-newbees like me get an error instead of grey hairs :)
Yeah, I thought about that too, but I think the option to send a <string> is actually sort of a feature and not a bug--that is, if you just want to insert text into the DB, that does make it simpler (no need to base64-encode).
Status: REOPENED → RESOLVED
Closed: 14 years ago → 14 years ago
Resolution: --- → INVALID
![]() |
||
Comment 8•14 years ago
|
||
(In reply to comment #7)
> Are you sure?
Yes, I'm sure.
Assignee | ||
Comment 11•12 years ago
|
||
(In reply to Max Kanat-Alexander from comment #7)
> Yeah, I thought about that too, but I think the option to send a <string>
> is actually sort of a feature and not a bug--that is, if you just want to
> insert text into the DB, that does make it simpler (no need to
> base64-encode).
Then we should document it that way.
Status: RESOLVED → REOPENED
Resolution: INVALID → ---
Assignee | ||
Comment 12•12 years ago
|
||
This patch updates the POD docs to illustrate the ability to send as a string type, and point out that base64 is required when encoding non-ascii data
Assignee: webservice → justdave
Attachment #518505 -
Attachment is obsolete: true
Attachment #683138 -
Flags: review?(LpSolit)
![]() |
||
Comment 13•12 years ago
|
||
Comment on attachment 683138 [details] [diff] [review]
Patch v2
>+B<Required> C<base64> or C<string> The content of the attachment.
>+If the content of the attachment is not ASCII text, you must send
>+it using the C<base64> type.
r=LpSolit, though I suspect users will still mix "encoded using base64 + passing it as string" and "encoded using base64 + declaring the encoded string as base64". Maybe you could make this even clearer: "encoding your attachment as base64 is not enough. You must declare it as being of type base64 too" or something like that.
Attachment #683138 -
Flags: review?(LpSolit) → review+
Assignee | ||
Comment 14•12 years ago
|
||
looks good to me.
![]() |
||
Updated•12 years ago
|
Summary: When creating attachment through web services, content is not decoded from base64 → Make the documentation clearer that attachments created with Bug.add_attachment must be of type 'base64'
Assignee | ||
Comment 15•12 years ago
|
||
Updated wording to be more explicit.
This patch applies cleanly on all branches 4.0 and newer. Any objection to committing it on all of 4.0, 4.2, 4.4, and trunk?
Attachment #683138 -
Attachment is obsolete: true
Attachment #683472 -
Flags: review?(LpSolit)
![]() |
||
Comment 16•12 years ago
|
||
Comment on attachment 683472 [details] [diff] [review]
Patch v3
r=LpSolit
Attachment #683472 -
Flags: review?(LpSolit) → review+
![]() |
||
Comment 17•12 years ago
|
||
It's fine to fix doc on all supported branches, so no problem to take it for 4.0 and newer (this method doesn't exist in 3.6).
Status: REOPENED → ASSIGNED
Flags: approval4.4+
Flags: approval4.2+
Flags: approval4.0+
Flags: approval+
Target Milestone: --- → Bugzilla 4.0
Assignee | ||
Comment 18•12 years ago
|
||
Bug 640756 - Make the documentation clearer that attachments created with Bug.add_attachment must by of type 'base64' when non-ASCII
.
r=LpSolit, a=LpSolit
Committing to: /home/dave/Source/bugzilla/
modified Bugzilla/WebService/Bug.pm
Committed revision 8481.
Pushed up to revision 8481.
Committing to: /home/dave/Source/bugzilla-4.4/
modified Bugzilla/WebService/Bug.pm
Committed revision 8465.
Pushed up to revision 8465.
Committing to: /home/dave/Source/bugzilla-4.2/
modified Bugzilla/WebService/Bug.pm
Committed revision 8173.
Pushed up to revision 8173.
Committing to: /home/dave/Source/bugzilla-4.0/
modified Bugzilla/WebService/Bug.pm
Committed revision 7737.
Pushed up to revision 7737.
Status: ASSIGNED → RESOLVED
Closed: 14 years ago → 12 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•