From b5f7406998439309576aa6db24cf9a683cadd016 Mon Sep 17 00:00:00 2001 From: Truman Gao <106889354+tdgao@users.noreply.github.com> Date: Tue, 16 Jun 2026 12:22:52 -0600 Subject: [PATCH] fix: game version filter in search using quotes instead of backticks (#6415) --- packages/ui/src/utils/search.ts | 20 ++++++++++---------- packages/ui/src/utils/server-search.ts | 9 +++++---- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/packages/ui/src/utils/search.ts b/packages/ui/src/utils/search.ts index 58ca55eb4..05d22f42e 100644 --- a/packages/ui/src/utils/search.ts +++ b/packages/ui/src/utils/search.ts @@ -484,7 +484,7 @@ export function useSearch( } orGroups[field].push(val) } else { - parts.push(`${field} = ${enquoteNonBools(val)}`) + parts.push(`${field} = ${formatSearchFilterValue(val)}`) } } } @@ -492,15 +492,15 @@ export function useSearch( for (const [field, values] of Object.entries(orGroups)) { if (values.length === 1) { const val = values[0] - parts.push(`${field} = ${enquoteNonBools(val)}`) + parts.push(`${field} = ${formatSearchFilterValue(val)}`) } else { - const quoted = values.map(enquoteNonBools).join(', ') + const quoted = values.map(formatSearchFilterValue).join(', ') parts.push(`${field} IN [${quoted}]`) } } for (const [field, values] of Object.entries(negativeByType)) { - const quoted = values.map(enquoteNonBools).join(', ') + const quoted = values.map(formatSearchFilterValue).join(', ') parts.push(`${field} NOT IN [${quoted}]`) } @@ -514,11 +514,11 @@ export function useSearch( for (const envGroup of getEnvironmentFilterGroups(client, server)) { if (envGroup.length === 1) { const [field, val] = envGroup[0].split(':') - parts.push(`${field} = ${enquoteNonBools(val)}`) + parts.push(`${field} = ${formatSearchFilterValue(val)}`) } else if (envGroup.length > 1) { const conditions = envGroup.map((f) => { const [field, val] = f.split(':') - return `${field} = ${enquoteNonBools(val)}` + return `${field} = ${formatSearchFilterValue(val)}` }) parts.push(`(${conditions.join(' OR ')})`) } @@ -527,9 +527,9 @@ export function useSearch( // Project types const mappedProjectTypes = projectTypes.value.map(mapProjectTypeToSearch) if (mappedProjectTypes.length === 1) { - parts.push(`project_types = ${enquoteNonBools(mappedProjectTypes[0])}`) + parts.push(`project_types = ${formatSearchFilterValue(mappedProjectTypes[0])}`) } else if (mappedProjectTypes.length > 1) { - const quoted = mappedProjectTypes.map(enquoteNonBools).join(', ') + const quoted = mappedProjectTypes.map(formatSearchFilterValue).join(', ') parts.push(`project_types IN [${quoted}]`) } @@ -792,11 +792,11 @@ function getEnvironmentFilterGroups(client: boolean, server: boolean): string[][ return groups } -function enquoteNonBools(value: string): string { +export function formatSearchFilterValue(value: string): string { if (value === 'true' || value === 'false') { return value } - return `"${value}"` + return `\`${value}\`` } function getOptionValue(option: FilterOption, negative?: boolean): string { diff --git a/packages/ui/src/utils/server-search.ts b/packages/ui/src/utils/server-search.ts index cc029aa7c..69e565057 100644 --- a/packages/ui/src/utils/server-search.ts +++ b/packages/ui/src/utils/server-search.ts @@ -6,6 +6,7 @@ import { useRoute } from 'vue-router' import { defineMessage, LOCALES, useVIntl } from '../composables/i18n' import type { FilterType, FilterValue, SortType, Tags } from './search' +import { formatSearchFilterValue } from './search' import { formatCategory, formatCategoryHeader } from './tag-messages' export const SERVER_REGIONS = { @@ -363,11 +364,11 @@ export function useServerSearch(opts: { const included = matched.filter((f) => !f.negative) const excluded = matched.filter((f) => f.negative) if (included.length > 0) { - const values = included.map((f) => `"${f.option}"`).join(', ') + const values = included.map((f) => formatSearchFilterValue(f.option)).join(', ') parts.push(`${field} IN [${values}]`) } if (excluded.length > 0) { - const values = excluded.map((f) => `"${f.option}"`).join(', ') + const values = excluded.map((f) => formatSearchFilterValue(f.option)).join(', ') parts.push(`${field} NOT IN [${values}]`) } } @@ -389,11 +390,11 @@ export function useServerSearch(opts: { .map((filter) => filter.projectId) if (includedProjectIds.length > 0) { - const values = includedProjectIds.map((projectId) => `"${projectId}"`).join(', ') + const values = includedProjectIds.map(formatSearchFilterValue).join(', ') parts.push(`project_id IN [${values}]`) } if (excludedProjectIds.length > 0) { - const values = excludedProjectIds.map((projectId) => `"${projectId}"`).join(', ') + const values = excludedProjectIds.map(formatSearchFilterValue).join(', ') parts.push(`project_id NOT IN [${values}]`) }