Updating internal search to disable features were required.

This commit is contained in:
mike12345567 2021-07-23 13:29:50 +01:00
parent e24c6bafd1
commit a5d9883f28
2 changed files with 11 additions and 11 deletions

View File

@ -22,7 +22,7 @@ const preprocess = (
}
// Escape characters
if (options.escape) {
if (options.escape && originalType === "string") {
value = `${value}`.replace(/[ #+\-&|!(){}\]^"~*?:\\]/g, "\\$&")
}
@ -136,7 +136,8 @@ class QueryBuilder {
function build(structure, queryFn) {
for (let [key, value] of Object.entries(structure)) {
key = preprocess(key.replace(/ /, "_"), {
escape: true,
wrap: false,
lowercase: false,
})
const expression = queryFn(key, value)
if (expression == null) {
@ -152,10 +153,7 @@ class QueryBuilder {
if (!value) {
return null
}
value = preprocess(value, {
escape: true,
lowercase: true,
})
value = preprocess(value)
return `${key}:${value}*`
})
}
@ -180,10 +178,7 @@ class QueryBuilder {
if (!value) {
return null
}
value = preprocess(value, {
escape: true,
lowercase: true,
})
value = preprocess(value)
return `${key}:${value}~`
})
}

View File

@ -12,7 +12,12 @@ module.exports = async (ctx, next) => {
// try to get the appID from the request
const requestAppId = getAppId(ctx)
// get app cookie if it exists
const appCookie = getCookie(ctx, Cookies.CurrentApp)
let appCookie = null
try {
appCookie = getCookie(ctx, Cookies.CurrentApp)
} catch (err) {
clearCookie(ctx, Cookies.CurrentApp)
}
if (!appCookie && !requestAppId) {
return next()
}