From cc0e0d32ea7f65475630bcdee1f1fa8a8c71eb05 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 26 Jun 2020 16:01:04 +0200 Subject: Fix query string parsing --- .../moderation/video-abuse-list/video-abuse-details.component.html | 4 ++-- client/src/app/core/rest/rest.service.ts | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'client/src/app') diff --git a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-details.component.html b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-details.component.html index 5512bb1de..ec808cdb8 100644 --- a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-details.component.html +++ b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-details.component.html @@ -17,7 +17,7 @@ {{ videoAbuse.reporterAccount.nameWithHost }} - + {videoAbuse.countReportsForReporter, plural, =1 {1 report} other {{{ videoAbuse.countReportsForReporter }} reports}} @@ -90,4 +90,4 @@
- \ No newline at end of file + diff --git a/client/src/app/core/rest/rest.service.ts b/client/src/app/core/rest/rest.service.ts index 78558851a..c12b6bd41 100644 --- a/client/src/app/core/rest/rest.service.ts +++ b/client/src/app/core/rest/rest.service.ts @@ -68,8 +68,9 @@ export class RestService { parseQueryStringFilter (q: string, prefixes: QueryStringFilterPrefixes): ParseQueryStringFilterResult { if (!q) return {} - // Tokenize the strings using spaces - const tokens = q.split(' ').filter(token => !!token) + // Tokenize the strings using spaces that are not in quotes + const tokens = q.match(/(?:[^\s"]+|"[^"]*")+/g) + .filter(token => !!token) // Build prefix array const prefixeStrings = Object.values(prefixes) @@ -88,6 +89,7 @@ export class RestService { const matchedTokens = tokens.filter(t => t.startsWith(prefix)) .map(t => t.slice(prefix.length)) // Keep the value filter + .map(t => t.replace(/^"|"$/g, '')) .map(t => { if (prefixObj.handler) return prefixObj.handler(t) -- cgit v1.2.3