fix(images): cap the search at the listing API's 500 characters
A longer paste was sent as is, the API rejected it and the collection showed "Images could not be loaded". The legacy search capped it.
This commit is contained in:
@@ -138,6 +138,8 @@ test('toolbar emits concept markup and order', async () => {
|
||||
assert.equal(input.id, 'search');
|
||||
assert.equal(input.type, 'search');
|
||||
assert.equal(input.placeholder, 'Search prompts, tags, filenames…');
|
||||
// The listing API rejects search text over 500 characters, as the legacy search capped it.
|
||||
assert.equal(input.maxLength, 500);
|
||||
assert.equal(input.getAttribute('aria-label'), 'Search workspace');
|
||||
assert.equal(input.value, 'castle');
|
||||
|
||||
|
||||
@@ -68,6 +68,8 @@ export function mountToolbar(container, { scope, categories = [], sorts, value =
|
||||
search.id = 'search';
|
||||
search.type = 'search';
|
||||
search.placeholder = 'Search prompts, tags, filenames…';
|
||||
// The listing API rejects longer search text (py/api/images.py _workspace_filters).
|
||||
search.maxLength = 500;
|
||||
search.setAttribute('aria-label', 'Search workspace');
|
||||
label.append(createWorkspaceIcon('search'), search);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user