Open raulrpearson opened 4 years ago
First, thanks for the report, glad to have a chance to fix this.
I'm looking at the code, and it seems to me that there's code at the top of the switch statement that provides a good answer.
If I make the change are you in a position to test that it works. That is, can you call it again with the "bad arguments"?
Yes, let me know how I can help.
I'm using your library to make calls to the Odoo API and I believe the call that is creating the problem goes something like this:
xmlrpc.client(
"url",
"execute_kw",
[
"db_string",
parseInt("uid_string"),
"pass_string",
"odoo_model",
"search_read",
[[[ "id", "=", undefined ]]],
],
"xml",
callback
);
If I check my args before I make the call–specifically, if I don't pass an undefined–I stop getting the problem. Which I assume is just that the default case is never being reached.
I fixed getXmlValue -- it should now correctly generate the <base64> encoding in the default case.
The new version is 0.4.26.
Thanks, Dave. I updated and triggered the same conditions and got TypeError: Cannot read property 'toString' of undefined
. Which, when looking at the code, makes sense. I shouldn't be passing in an undefined
in the first place.
How does one xmlize undefined
or null
? Is there a convention for that in XML?
An alternative might be to throw a descriptive error when encountering those values.
Anyway, thanks for checking this out so quickly.
I'm using
xmlrpc.client
in Node.js and I found out that I was sometimes calling it with bad arguments which triggered this default case I assume, which threwReferenceError: btoa is not defined
.As far as I'm aware, btoa is not available in Node.js and maybe this would require an alternative solution.