mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-22 15:25:46 +00:00
fix(search): local index rejects FTS syntax in live search queries (#983)
* fix(search): reject FTS syntax chars in local index live search queries FTS5 treats `=` and similar characters as query syntax, so tokens like 1=2 produced unrelated prefix hits. Skip FTS for unsafe tokens instead. * docs: CHANGELOG for local index FTS syntax query fix (PR #983) * fix(search): reject syntax junk in server search3 and live search race Share FTS-safe token guard with search3; skip network invoke for ** and similar queries; show empty dropdown without misleading source badge. * fix(search): allow censorship stars in queries, reject wildcard-only tokens Block ** and **** but keep ***Flawless-style title searches working in local FTS and search3.
This commit is contained in:
@@ -3,6 +3,7 @@ import { onInvoke } from '@/test/mocks/tauri';
|
||||
import type { SearchResults } from '../../api/subsonicTypes';
|
||||
import { useAuthStore } from '@/store/authStore';
|
||||
import {
|
||||
liveSearchQueryRejected,
|
||||
liveSearchQueryTooShort,
|
||||
mergeLiveSearchResults,
|
||||
runLocalLiveSearch,
|
||||
@@ -92,6 +93,16 @@ describe('runLocalLiveSearch', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('liveSearchQueryRejected', () => {
|
||||
it('rejects syntax junk and single-character queries', () => {
|
||||
expect(liveSearchQueryRejected('**')).toBe(true);
|
||||
expect(liveSearchQueryRejected('1=2')).toBe(true);
|
||||
expect(liveSearchQueryRejected('а')).toBe(true);
|
||||
expect(liveSearchQueryRejected('ab')).toBe(false);
|
||||
expect(liveSearchQueryRejected('metallica')).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('liveSearchQueryTooShort', () => {
|
||||
it('treats one grapheme as too short', () => {
|
||||
expect(liveSearchQueryTooShort('а')).toBe(true);
|
||||
|
||||
Reference in New Issue
Block a user