encode quoted queries into raw

This commit is contained in:
ed 2021-11-22 21:53:23 +01:00
parent 0278bf328f
commit a3efc4c726
2 changed files with 33 additions and 3 deletions

View file

@ -122,8 +122,7 @@ class U2idx(object):
while v.endswith("\\"):
v2, uq = uq.split('"', 1)
v = v[:-1] + '"' + v2
v2, uq = (uq + " ").split(" ", 1)
v += v2
uq = uq.strip()
else:
v, uq = (uq + " ").split(" ", 1)
v = v.replace('\\"', '"')

View file

@ -3234,7 +3234,34 @@ document.onkeydown = function (e) {
for (var b = 1; b < sconf[a].length; b++) {
var k = sconf[a][b][0],
chk = 'srch_' + k + 'c',
tvs = ebi('srch_' + k + 'v').value.split(/ +/g);
vs = ebi('srch_' + k + 'v').value,
tvs = [];
if (k == 'name')
console.log('a');
while (vs) {
vs = vs.trim();
if (!vs)
break;
var v = '';
if (vs.startsWith('"')) {
var vp = vs.slice(1).split(/"(.*)/);
v = vp[0];
vs = vp[1] || '';
while (v.endsWith('\\')) {
vp = vs.split(/"(.*)/);
v = v.slice(0, -1) + '"' + vp[0];
vs = vp[1] || '';
}
}
else {
var vp = vs.split(/ +(.*)/);
v = vp[0].replace(/\\"/g, '"');
vs = vp[1] || '';
}
tvs.push(v);
}
if (!ebi(chk).checked)
continue;
@ -3277,6 +3304,10 @@ document.onkeydown = function (e) {
tv += '*';
}
if (tv.indexOf(' ') + 1) {
tv = '"' + tv + '"';
}
q += k + not + 'like ' + tv;
}
}