aboutsummaryrefslogtreecommitdiffhomepage
path: root/client
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-06-26 16:01:04 +0200
committerChocobozzz <me@florianbigard.com>2020-06-26 16:08:53 +0200
commitcc0e0d32ea7f65475630bcdee1f1fa8a8c71eb05 (patch)
tree1628ade33a809056c8f755fe83c5e167f46f28ec /client
parentd8b382912e82a535c8158ee496fe396a84851b4e (diff)
downloadPeerTube-cc0e0d32ea7f65475630bcdee1f1fa8a8c71eb05.tar.gz
PeerTube-cc0e0d32ea7f65475630bcdee1f1fa8a8c71eb05.tar.zst
PeerTube-cc0e0d32ea7f65475630bcdee1f1fa8a8c71eb05.zip
Fix query string parsing
Diffstat (limited to 'client')
-rw-r--r--client/src/app/+admin/moderation/video-abuse-list/video-abuse-details.component.html4
-rw-r--r--client/src/app/core/rest/rest.service.ts6
2 files changed, 6 insertions, 4 deletions
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 @@
17 <span class="text-muted">{{ videoAbuse.reporterAccount.nameWithHost }}</span> 17 <span class="text-muted">{{ videoAbuse.reporterAccount.nameWithHost }}</span>
18 </div> 18 </div>
19 </a> 19 </a>
20 <a [routerLink]="[ '/admin/moderation/video-abuses/list' ]" [queryParams]="{ 'search': 'reportee:&quot;' + videoAbuse.reporterAccount.displayName + '&quot;' }" class="ml-auto text-muted video-details-links" i18n> 20 <a [routerLink]="[ '/admin/moderation/video-abuses/list' ]" [queryParams]="{ 'search': 'reporter:&quot;' + videoAbuse.reporterAccount.displayName + '&quot;' }" class="ml-auto text-muted video-details-links" i18n>
21 {videoAbuse.countReportsForReporter, plural, =1 {1 report} other {{{ videoAbuse.countReportsForReporter }} reports}}<span class="ml-1 glyphicon glyphicon-flag"></span> 21 {videoAbuse.countReportsForReporter, plural, =1 {1 report} other {{{ videoAbuse.countReportsForReporter }} reports}}<span class="ml-1 glyphicon glyphicon-flag"></span>
22 </a> 22 </a>
23 </span> 23 </span>
@@ -90,4 +90,4 @@
90 <div *ngIf="!videoAbuse.video.deleted && !videoAbuse.video.blacklisted" [innerHTML]="videoAbuse.embedHtml"></div> 90 <div *ngIf="!videoAbuse.video.deleted && !videoAbuse.video.blacklisted" [innerHTML]="videoAbuse.embedHtml"></div>
91 </div> 91 </div>
92 </div> 92 </div>
93</div> \ No newline at end of file 93</div>
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 {
68 parseQueryStringFilter (q: string, prefixes: QueryStringFilterPrefixes): ParseQueryStringFilterResult { 68 parseQueryStringFilter (q: string, prefixes: QueryStringFilterPrefixes): ParseQueryStringFilterResult {
69 if (!q) return {} 69 if (!q) return {}
70 70
71 // Tokenize the strings using spaces 71 // Tokenize the strings using spaces that are not in quotes
72 const tokens = q.split(' ').filter(token => !!token) 72 const tokens = q.match(/(?:[^\s"]+|"[^"]*")+/g)
73 .filter(token => !!token)
73 74
74 // Build prefix array 75 // Build prefix array
75 const prefixeStrings = Object.values(prefixes) 76 const prefixeStrings = Object.values(prefixes)
@@ -88,6 +89,7 @@ export class RestService {
88 89
89 const matchedTokens = tokens.filter(t => t.startsWith(prefix)) 90 const matchedTokens = tokens.filter(t => t.startsWith(prefix))
90 .map(t => t.slice(prefix.length)) // Keep the value filter 91 .map(t => t.slice(prefix.length)) // Keep the value filter
92 .map(t => t.replace(/^"|"$/g, ''))
91 .map(t => { 93 .map(t => {
92 if (prefixObj.handler) return prefixObj.handler(t) 94 if (prefixObj.handler) return prefixObj.handler(t)
93 95