Improve backward compatibility if preferences are not passed

This commit is contained in:
Cohee 2024-11-13 11:09:21 +02:00 committed by GitHub
parent f880c68968
commit 61ddb720d7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -188,7 +188,7 @@ router.post('/searxng', jsonParser, async (request, response) => {
const searchUrl = new URL('/search', baseUrl); const searchUrl = new URL('/search', baseUrl);
const searchParams = new URLSearchParams(); const searchParams = new URLSearchParams();
searchParams.append('q', query); searchParams.append('q', query);
if (preferences.length > 0) { if (preferences) {
searchParams.append('preferences', preferences); searchParams.append('preferences', preferences);
} }
searchUrl.search = searchParams.toString(); searchUrl.search = searchParams.toString();