Fix base64 padding with multiple =-signs. An equal amount of dots is required in output

instead of merging all =-signs into one dot, which can then not be
decoded. Test string:

SELECT * from version  where "isHelper" order by "order" desc

will be encode to

U0VMRUNUICogZnJvbSB2ZXJzaW9uICB3aGVyZSAiaXNIZWxwZXIiIG9yZGVyIGJ5ICJvcmRlciIgZGVzYw.

missing a dot at the end making it undecodable.

Since =-signs only appear at the end anyway, we don't need the explicit
'$' in the regexp
This commit is contained in:
Sjon Hortensius 2016-10-03 16:12:14 +02:00
parent e52782fe9c
commit 2f69538576

View File

@ -96,7 +96,7 @@ function explainQuery(query, cb) { apiCall("post", "/explain", { quer
function disconnect(cb) { apiCall("post", "/disconnect", {}, cb); } function disconnect(cb) { apiCall("post", "/disconnect", {}, cb); }
function encodeQuery(query) { function encodeQuery(query) {
return window.btoa(query).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "."); return window.btoa(query).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, ".");
} }
function buildSchemaSection(name, objects) { function buildSchemaSection(name, objects) {