I’m uploading a zip file to Bugzilla with the following code:
bug.AppendAttachment("someComment", "application/octet-stream", "somedata",
"filePath", bugId, false, false, false, "someSummary");
The false parameters are:
1. is_Url
2. is_patch
3. is_private
The file is uploaded, and when I login to Bugzilla and download id, a message appears which says it’s corrupted or damaged and cannot be opened. Why is this happening? When I’m uploading it by hand, everything is ok.
We need to see your addition of
AppendAttachmentto further answer this. However, per http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Bug.html#add_attachment, you need to ensure that whatever you’re passing to “data” is properly Base64-encoded.If
somedatais what you are directly passing todata, you need to first encode your binary data (the Zip file) to Base64 using http://msdn.microsoft.com/en-us/library/dhx0d524.aspx.If you attempt to store your binary data as a String at any point before encoding it with Base64, you will corrupt your payload.