change query encoding to old style meta

This commit is contained in:
Stewart Allen 2020-06-04 15:19:01 -04:00
commit 5677d70449
2 changed files with 4 additions and 5 deletions

4
app.js
View file

@ -380,9 +380,9 @@ function string2obj(s) {
function handleVersion(req, res, next) {
if (req.app.path === "/kiri/" && req.url.indexOf(version) < 0) {
if (req.url.indexOf("?") > 0) {
return http.redirect(res, `${req.url}&ver=${version}`);
return http.redirect(res, `${req.url},ver:${version}`);
} else {
return http.redirect(res, `${req.url}?ver=${version}`);
return http.redirect(res, `${req.url}?ver:${version}`);
}
} else {
next();

View file

@ -403,7 +403,6 @@
let opt = {}, kv, kva;
// handle kiri legacy and proper url encoding better
ov.replace(/&/g,',').split(',').forEach(function(el) {
// el = el.replace(/=/g,':');
kv = decodeURIComponent(el).split(':');
if (kv.length === 2) {
kva = opt[kv[0]] = opt[kv[0]] || [];
@ -418,9 +417,9 @@
Object.keys(opt).forEach(key => {
if (key === 'ver') return;
let val = opt[key];
out.push(encodeURIComponent(key) + "=" + encodeURIComponent(val));
out.push(encodeURIComponent(key) + ":" + encodeURIComponent(val));
});
return out.length ? '?' + out.join('&') : '';
return out.length ? '?' + out.join(',') : '';
}
function ajax(url, fn, rt, po, hd) {