From 62c7216b43d8666d628a8f1ab26fd3e04aaf1f20 Mon Sep 17 00:00:00 2001 From: Franco Montenegro Date: Fri, 12 Feb 2021 14:14:53 -0300 Subject: [PATCH] Fix mediaType filter parameter in search --- ui/util/query-params.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ui/util/query-params.js b/ui/util/query-params.js index c0236b070..f6676274f 100644 --- a/ui/util/query-params.js +++ b/ui/util/query-params.js @@ -10,10 +10,10 @@ export function parseQueryParams(queryString: string) { .split('?') .pop() .split('&') - .map(p => p.split('=')); + .map((p) => p.split('=')); const params = {}; - parts.forEach(array => { + parts.forEach((array) => { const [first, second] = array; params[first] = second; }); @@ -46,8 +46,9 @@ export const getSearchQueryString = (query: string, options: any = {}) => { if (claimType) { queryParams.push(`claimType=${claimType}`); - // If they are only searching for channels, strip out the media info - if (!claimType.includes(SEARCH_OPTIONS.INCLUDE_CHANNELS)) { + const searchingFiles = claimType.includes(SEARCH_OPTIONS.INCLUDE_FILES); + + if (searchingFiles) { queryParams.push( `mediaType=${[ SEARCH_OPTIONS.MEDIA_FILE, @@ -69,7 +70,7 @@ export const getSearchQueryString = (query: string, options: any = {}) => { if (nsfw === false) additionalOptions['nsfw'] = false; if (additionalOptions) { - Object.keys(additionalOptions).forEach(key => { + Object.keys(additionalOptions).forEach((key) => { const option = additionalOptions[key]; queryParams.push(`${key}=${option}`); });