1
0
Fork 0
mirror of synced 2024-06-30 03:50:37 +12:00

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
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()
}