aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/core
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/core')
-rw-r--r--client/src/app/core/rest/rest.service.ts14
1 files changed, 10 insertions, 4 deletions
diff --git a/client/src/app/core/rest/rest.service.ts b/client/src/app/core/rest/rest.service.ts
index 59152e658..b2a5a3f72 100644
--- a/client/src/app/core/rest/rest.service.ts
+++ b/client/src/app/core/rest/rest.service.ts
@@ -82,13 +82,11 @@ export class RestService {
82 parseQueryStringFilter <T extends QueryStringFilterPrefixes> (q: string, prefixes: T): ParseQueryStringFiltersResult<keyof T> { 82 parseQueryStringFilter <T extends QueryStringFilterPrefixes> (q: string, prefixes: T): ParseQueryStringFiltersResult<keyof T> {
83 if (!q) return {} 83 if (!q) return {}
84 84
85 // Tokenize the strings using spaces that are not in quotes 85 const tokens = this.tokenizeString(q)
86 const tokens = q.match(/(?:[^\s"]+|"[^"]*")+/g)
87 .filter(token => !!token)
88 86
89 // Build prefix array 87 // Build prefix array
90 const prefixeStrings = Object.values(prefixes) 88 const prefixeStrings = Object.values(prefixes)
91 .map(p => p.prefix) 89 .map(p => p.prefix)
92 90
93 logger(`Built tokens "${tokens.join(', ')}" for prefixes "${prefixeStrings.join(', ')}"`) 91 logger(`Built tokens "${tokens.join(', ')}" for prefixes "${prefixeStrings.join(', ')}"`)
94 92
@@ -137,4 +135,12 @@ export class RestService {
137 ...additionalFilters 135 ...additionalFilters
138 } 136 }
139 } 137 }
138
139 tokenizeString (q: string) {
140 if (!q) return []
141
142 // Tokenize the strings using spaces that are not in quotes
143 return q.match(/(?:[^\s"]+|"[^"]*")+/g)
144 .filter(token => !!token)
145 }
140} 146}