change query encoding to old style meta
This commit is contained in:
parent
4910da0349
commit
65947772f0
2 changed files with 4 additions and 5 deletions
4
app.js
4
app.js
|
|
@ -404,9 +404,9 @@ function string2obj(s) {
|
||||||
function handleVersion(req, res, next) {
|
function handleVersion(req, res, next) {
|
||||||
if (req.app.path === "/kiri/" && req.url.indexOf(version) < 0) {
|
if (req.app.path === "/kiri/" && req.url.indexOf(version) < 0) {
|
||||||
if (req.url.indexOf("?") > 0) {
|
if (req.url.indexOf("?") > 0) {
|
||||||
return http.redirect(res, `${req.url}&ver=${version}`);
|
return http.redirect(res, `${req.url},ver:${version}`);
|
||||||
} else {
|
} else {
|
||||||
return http.redirect(res, `${req.url}?ver=${version}`);
|
return http.redirect(res, `${req.url}?ver:${version}`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
next();
|
next();
|
||||||
|
|
|
||||||
|
|
@ -407,7 +407,6 @@ self.kiri.copyright = exports.COPYRIGHT;
|
||||||
let opt = {}, kv, kva;
|
let opt = {}, kv, kva;
|
||||||
// handle kiri legacy and proper url encoding better
|
// handle kiri legacy and proper url encoding better
|
||||||
ov.replace(/&/g,',').split(',').forEach(function(el) {
|
ov.replace(/&/g,',').split(',').forEach(function(el) {
|
||||||
// el = el.replace(/=/g,':');
|
|
||||||
kv = decodeURIComponent(el).split(':');
|
kv = decodeURIComponent(el).split(':');
|
||||||
if (kv.length === 2) {
|
if (kv.length === 2) {
|
||||||
kva = opt[kv[0]] = opt[kv[0]] || [];
|
kva = opt[kv[0]] = opt[kv[0]] || [];
|
||||||
|
|
@ -422,9 +421,9 @@ self.kiri.copyright = exports.COPYRIGHT;
|
||||||
Object.keys(opt).forEach(key => {
|
Object.keys(opt).forEach(key => {
|
||||||
if (key === 'ver') return;
|
if (key === 'ver') return;
|
||||||
let val = opt[key];
|
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) {
|
function ajax(url, fn, rt, po, hd) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue