X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fcore%2Frest%2Frest.service.ts;h=b2a5a3f72a13cd749111cb6bdcad6bbe3373bd45;hb=dd6d2a7ce50e7ff02e00995ccc87f8f929ad9709;hp=59152e65855bee70df5ae0b6f300222b9fb64db3;hpb=d324756edb836672f12284cd18e642a658b273d8;p=github%2FChocobozzz%2FPeerTube.git 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 { parseQueryStringFilter (q: string, prefixes: T): ParseQueryStringFiltersResult { if (!q) return {} - // Tokenize the strings using spaces that are not in quotes - const tokens = q.match(/(?:[^\s"]+|"[^"]*")+/g) - .filter(token => !!token) + const tokens = this.tokenizeString(q) // Build prefix array const prefixeStrings = Object.values(prefixes) - .map(p => p.prefix) + .map(p => p.prefix) logger(`Built tokens "${tokens.join(', ')}" for prefixes "${prefixeStrings.join(', ')}"`) @@ -137,4 +135,12 @@ export class RestService { ...additionalFilters } } + + tokenizeString (q: string) { + if (!q) return [] + + // Tokenize the strings using spaces that are not in quotes + return q.match(/(?:[^\s"]+|"[^"]*")+/g) + .filter(token => !!token) + } }