Skip to content

Sanitize comma in search queries#7

Merged
ALERTua merged 2 commits intomainfrom
comma_search
Jan 31, 2026
Merged

Sanitize comma in search queries#7
ALERTua merged 2 commits intomainfrom
comma_search

Conversation

@ALERTua
Copy link
Copy Markdown
Owner

@ALERTua ALERTua commented Jan 31, 2026

due to

2026-01-31 18:09:17.867 ERROR (MainThread) [music_assistant.webserver] Error handling message: CommandMessage(message_id='5ee152ef-b03f-459d-aa2b-98dd69f2f46a', command='music/search', args={'search_query': 'Midnight, Glow Vol.', 'limit': 8})
Traceback (most recent call last):
  File "/app/venv/lib/python3.13/site-packages/music_assistant/providers/bandcamp/__init__.py", line 135, in search
    search_results = await self._client.search(search_query)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/venv/lib/python3.13/site-packages/bandcamp_async_api/client.py", line 127, in search
    data = await self._get(url=url, params=params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/venv/lib/python3.13/site-packages/bandcamp_async_api/client.py", line 108, in _get
    return await self._request(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/venv/lib/python3.13/site-packages/bandcamp_async_api/client.py", line 103, in _request
    return self._process_json_responce(resp_json)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
  File "/app/venv/lib/python3.13/site-packages/bandcamp_async_api/client.py", line 84, in _process_json_responce
    raise BandcampAPIError(resp_json)
bandcamp_async_api.client.BandcampAPIError: {'error': True, 'error_message': 'too many q terms; max 1'}
The above exception was the direct cause of the following exception:

- Add `validate-pyproject` hook to pre-commit configuration.
- Sanitize comma in query input to prevent API errors.
- Add test for comma sanitization in search queries.
@ALERTua ALERTua merged commit 5f6a566 into main Jan 31, 2026
6 checks passed
@ALERTua ALERTua deleted the comma_search branch January 31, 2026 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant