fix: Обновить проверку лимита в API для корректной обработки запросов, улучшив фильтрацию данных и предотвращая ошибки при некорректных значениях лимита
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 1m41s

This commit is contained in:
2025-08-27 17:50:42 +07:00
parent cd3f7a84e3
commit 6a81ad9983
3 changed files with 15 additions and 9 deletions
+4 -4
View File
@@ -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,