Search filters for size (MB) and file extensions
- API: min_size and max_size in MB, ext as a comma-separated list. An extension matches as a whole word in search_text (file and entry names, dots as spaces), so "iso" finds .iso files but not "ISOLATION", which a plain search word matched as a substring. The trigram index serves it. - Web UI: a size range and an extension field in the filter row, kept in the URL like the other filters. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
95f1d427df
commit
e1392608d8
6 files changed
+110
-2
No files matched your search
@@ -47,6 +47,22 @@ test.group('Web API', (group) => {
|
||||
;(await client.get('/api/v1/releases/999999999')).assertStatus(404)
|
||||
})
|
||||
|
||||
test('filters by size in MB and by file extension as a whole word', async ({ client, assert }) => {
|
||||
const id = await seed() // 1400 bytes, an episode.mkv in its listing
|
||||
const ids = async (qs: Record<string, string>) =>
|
||||
(await client.get('/api/v1/releases').qs({ q: 'webtest', ...qs })).body().releases.map((r: any) => r.id)
|
||||
|
||||
assert.include(await ids({ min_size: '0.001', max_size: '0.002' }), id)
|
||||
assert.notInclude(await ids({ min_size: '1' }), id)
|
||||
assert.notInclude(await ids({ max_size: '0.001' }), id)
|
||||
|
||||
assert.include(await ids({ ext: 'mkv' }), id)
|
||||
assert.include(await ids({ ext: '.iso, MKV' }), id)
|
||||
assert.notInclude(await ids({ ext: 'iso' }), id)
|
||||
// "sho" is part of "show", not an extension.
|
||||
assert.notInclude(await ids({ ext: 'sho' }), id)
|
||||
})
|
||||
|
||||
test('serves an NZB with the real file name', async ({ client, assert }) => {
|
||||
const id = await seed()
|
||||
const response = await client.get(`/api/v1/releases/${id}/nzb`)
|
||||
|
||||
Reference in new issue
Block a user