- obsolete: 'bugzilla.addAttachment' accepted base64 data in string variable and stored them in database decoded
- current: 'Bug.add_attachment' accepts base64 data but it must be stored in base64 type, otherwise server doesn't decode the data and stores them as they are - related to issue #117 Signed-off-by: Jakub Filak <[email protected]> --- src/plugins/rhbz.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/plugins/rhbz.c b/src/plugins/rhbz.c index 3fb24e3..4dfb19e 100644 --- a/src/plugins/rhbz.c +++ b/src/plugins/rhbz.c @@ -668,18 +668,25 @@ int rhbz_attach_blob(struct abrt_xmlrpc *ax, const char *bug_id, { func_entry(); - char *encoded64 = encode_base64(data, data_len); char *fn = xasprintf("File: %s", filename); xmlrpc_value* result; int nomail_notify = !!IS_NOMAIL_NOTIFY(flags); - /* http://www.bugzilla.org/docs/4.2/en/html/api/Bugzilla/WebService/Bug.html#add_attachment */ - result = abrt_xmlrpc_call(ax, "Bug.add_attachment", "({s:(s),s:s,s:s,s:s,s:s,s:i})", + /* http://www.bugzilla.org/docs/4.2/en/html/api/Bugzilla/WebService/Bug.html#add_attachment + * + * XMLRPC format options: + * s -> string, single argument (char* value) + * i -> integer, single argument (int value) + * 6 -> base64, two arguments (char* plain data which will be encoded in base64, + * size_t number of bytes to encode) + */ + result = abrt_xmlrpc_call(ax, "Bug.add_attachment", "({s:(s),s:s,s:s,s:s,s:6,s:i})", "ids", bug_id, "summary", fn, "file_name", filename, "content_type", (flags & RHBZ_BINARY_ATTACHMENT) ? "application/octet-stream" : "text/plain", - "data", encoded64, + /* base64 type requires two arguments: char* (plain data) and size_t (length)*/ + "data", data, (size_t)data_len, /* Undocumented argument but it works with Red Hat Bugzilla version 4.2.4-7 * and version 4.4.rc1.b02 @@ -687,7 +694,6 @@ int rhbz_attach_blob(struct abrt_xmlrpc *ax, const char *bug_id, "nomail", nomail_notify ); - free(encoded64); free(fn); if (!result) return -1; -- 1.8.1
