Updating internal search to disable features were required.

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

View File

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

View File

@ -12,7 +12,12 @@ module.exports = async (ctx, next) => {
// try to get the appID from the request // try to get the appID from the request
const requestAppId = getAppId(ctx) const requestAppId = getAppId(ctx)
// get app cookie if it exists // 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) { if (!appCookie && !requestAppId) {
return next() return next()
} }