diff --git a/NEWS.md b/NEWS.md
index aa54b06..f54223f 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,3 +1,9 @@
+## JS-XMLRPC version 0.6.1 - 2022/12/19
+
+* fixed: `base64_encode('')` returns an empty string on all environments
+* improvement: `visualeditor.html?params=` will not preload the dialog with an empty parameter
+
+
## JS-XMLRPC version 0.6.0 - 2022/12/17
* BREAKING CHANGE: transformed the library in an ES6 module, available as NPM package "@jsxmlrpc/jsxmlrpc".
diff --git a/debugger/debugger.html b/debugger/debugger.html
index 6ddf540..f9d7fe5 100644
--- a/debugger/debugger.html
+++ b/debugger/debugger.html
@@ -754,7 +754,7 @@
Notices
Changelog
-- ver 0.6 - 2022/12/XX: removed unsupported handling of cookies; request/response compression; timeout
+- ver 0.6 - 2022/12/17: removed unsupported handling of cookies; request/response compression; timeout
diff --git a/doc/xmlrpc_js.xml b/doc/xmlrpc_js.xml
index fa4b630..e5d574d 100644
--- a/doc/xmlrpc_js.xml
+++ b/doc/xmlrpc_js.xml
@@ -8,10 +8,10 @@ JS-XMLRPC User manual
JS-XMLRPC
- version 0.6
+ version 0.6.1
- XX 12 2012
+ 19 12 2012
Gaetano Giunta
diff --git a/lib/xmlrpc_lib.js b/lib/xmlrpc_lib.js
index 30880f3..8f48b38 100644
--- a/lib/xmlrpc_lib.js
+++ b/lib/xmlrpc_lib.js
@@ -107,7 +107,7 @@ export var xmlrpcName = 'XML-RPC for JAVASCRIPT';
* Library version number. Used in the client's httprequests to identify self to server
* @type string
*/
-export var xmlrpcVersion = '0.6';
+export var xmlrpcVersion = '0.6.1';
// let user errors start at 800
export var xmlrpcerruser = 800;
@@ -2273,7 +2273,7 @@ export function xmlrpc_decode_xml(xml_val, options)
export function base64_decode (aString)
{
aString = aString.replace(/^\s+|\s+$/g, "");
- if ((aString.length % 4) == 0)
+ if ((aString.length % 4) === 0)
{
if (typeof atob === 'function')
{
@@ -2313,7 +2313,6 @@ export function base64_decode (aString)
* @param {string} aString
* @type string
* @public
- * @bug given an empty string, returns '0' in IE and Opera
*/
export function base64_encode (aString)
{
@@ -2324,27 +2323,31 @@ export function base64_encode (aString)
}
else
{
+ if (aString === '') {
+ return '';
+ }
+
var base64 = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',
'0','1','2','3','4','5','6','7','8','9','+','/'];
var sbin;
var pad = 0;
var s = '' + aString;
- if ((s.length % 3) == 1)
+ if ((s.length % 3) === 1)
{
s += String.fromCharCode(0);
s += String.fromCharCode(0);
pad = 2;
}
- else if ((s.length % 3) == 2)
+ else if ((s.length % 3) === 2)
{
s += String.fromCharCode(0);
pad = 1 ;
}
// create a result buffer, this is much faster than having strings concatenated
- var rslt = [s.length / 3];
+ var rslt = [s.length / 3]; /// @todo why do we use s.length / 3 here ?
var ri = 0;
- for(var i = 0; i < s.length; i += 3)
+ for (var i = 0; i < s.length; i += 3)
{
sbin = ((s.charCodeAt(i) & 0xff) << 16) | ((s.charCodeAt(i+1) & 0xff) << 8) | (s.charCodeAt(i+2) & 0xff);
rslt[ri] = (base64[(sbin >> 18) & 0x3f] + base64[(sbin >> 12) & 0x3f] + base64[(sbin >>6) & 0x3f] + base64[sbin & 0x3f]);
@@ -2352,7 +2355,7 @@ export function base64_encode (aString)
}
if (pad > 0)
{
- rslt[rslt.length-1] = rslt[rslt.length-1].substr(0, 4-pad) +((pad==2) ? '==' : (pad==1) ? '=' : '');
+ rslt[rslt.length-1] = rslt[rslt.length-1].substr(0, 4-pad) + ((pad === 2) ? '==' : (pad === 1) ? '=' : '');
}
return rslt.join('');
}
diff --git a/package.json b/package.json
index 8ae0c64..e5a978f 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@jsxmlrpc/jsxmlrpc",
- "version": "0.6.0",
+ "version": "0.6.1",
"description": "A javascript library for building xmlrpc and jsonrpc clients",
"keywords": [
"xmlrpc",