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) {
|
||||
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();
|
||||
|
|
|
|||
|
|
@ -407,7 +407,6 @@ self.kiri.copyright = exports.COPYRIGHT;
|
|||
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]] || [];
|
||||
|
|
@ -422,9 +421,9 @@ self.kiri.copyright = exports.COPYRIGHT;
|
|||
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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue