fix: Обновить проверку лимита в API для корректной обработки запросов, улучшив фильтрацию данных и предотвращая ошибки при некорректных значениях лимита
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 1m41s
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 1m41s
This commit is contained in:
+4
-4
@@ -500,7 +500,7 @@ app.get('/api/domains', async (req, res) => {
|
||||
const { total } = await streamPaginatedText({ key: FILE_KEY, q, offset: 0, limit: 0, mapLine: () => ({}) });
|
||||
setCountOnlyCache(cacheKey, total);
|
||||
return res.json(format === 'std' ? { items: [], total, meta: {} } : { total });
|
||||
} else if (typeof limit !== 'undefined') {
|
||||
} else if (Number(limit) > 0) {
|
||||
const { items, total } = await streamPaginatedText({
|
||||
key: FILE_KEY,
|
||||
q,
|
||||
@@ -596,7 +596,7 @@ app.get('/api/asns', async (req, res) => {
|
||||
const { total } = await streamPaginatedText({ key: 'bgp_data/asns.txt', q, offset: 0, limit: 0, mapLine: () => ({}) });
|
||||
setCountOnlyCache(cacheKey, total);
|
||||
return res.json(format === 'std' ? { items: [], total, meta: {} } : { total });
|
||||
} else if (limit !== undefined) {
|
||||
} else if (Number(limit) > 0) {
|
||||
const { items, total } = await streamPaginatedText({
|
||||
key: 'bgp_data/asns.txt',
|
||||
q,
|
||||
@@ -693,7 +693,7 @@ app.get('/api/domains-new', async (req, res) => {
|
||||
const { total } = await streamPaginatedText({ key: 'bgp_data/domains_community.txt', q, offset: 0, limit: 0, mapLine: () => ({}) });
|
||||
setCountOnlyCache(cacheKey, total);
|
||||
return res.json(format === 'std' ? { items: [], total, meta: {} } : { total });
|
||||
} else if (limit !== undefined) {
|
||||
} else if (Number(limit) > 0) {
|
||||
const { items, total } = await streamPaginatedText({
|
||||
key: 'bgp_data/domains_community.txt',
|
||||
q,
|
||||
@@ -790,7 +790,7 @@ app.get('/api/ip-ranges', async (req, res) => {
|
||||
const { total } = await streamPaginatedText({ key: 'bgp_data/ips.txt', q, offset: 0, limit: 0, mapLine: () => ({}) });
|
||||
setCountOnlyCache(cacheKey, total);
|
||||
return res.json(format === 'std' ? { items: [], total, meta: {} } : { total });
|
||||
} else if (limit !== undefined) {
|
||||
} else if (Number(limit) > 0) {
|
||||
const { items, total } = await streamPaginatedText({
|
||||
key: 'bgp_data/ips.txt',
|
||||
q,
|
||||
|
||||
Reference in New Issue
Block a user