From 10354f0603b3899729622352d3ba3995343427c8 Mon Sep 17 00:00:00 2001 From: Yousef Mohsen Date: Fri, 16 Feb 2024 11:05:51 +0100 Subject: [PATCH 1/2] input validation --- src/lib/api/faq.fragments.js | 7 +++++++ src/lib/api/universe.fragments.js | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/src/lib/api/faq.fragments.js b/src/lib/api/faq.fragments.js index e815da849..c57bdf957 100644 --- a/src/lib/api/faq.fragments.js +++ b/src/lib/api/faq.fragments.js @@ -1,6 +1,9 @@ import { ApiEnums } from "@/lib/api/api"; import { getLangcode } from "@/components/base/translate/Translate"; export function promotedFaqs(language) { + if (!language) { + return null; + } const langcode = getLangcode(language); return { apiUrl: ApiEnums.FBI_API, @@ -47,6 +50,10 @@ export function promotedFaqs(language) { * @returns {{variables: {}, slowThreshold: number, query: string}} */ export function publishedFaqs(language) { + if (!language) { + return null; + } + const langcode = getLangcode(language); return { apiUrl: ApiEnums.FBI_API, diff --git a/src/lib/api/universe.fragments.js b/src/lib/api/universe.fragments.js index 75525b55d..f67294053 100644 --- a/src/lib/api/universe.fragments.js +++ b/src/lib/api/universe.fragments.js @@ -77,6 +77,10 @@ export function universeContent({ key, workType, offset, limit }) { } export function universesBasicInfoByWork({ workId }) { + if (workId) { + return null; + } + return { apiUrl: ApiEnums.FBI_API, query: `query UniversesBasicInfoByWork($workId: String!) { @@ -96,6 +100,10 @@ export function universesBasicInfoByWork({ workId }) { } export function universesByWork({ workId, offset, limit }) { + if (workId) { + return null; + } + return { apiUrl: ApiEnums.FBI_API, query: `query UniversesByWork($workId: String!, $offset: Int, $limit: Int) { From bdd00af586a64bee079824befccd41b30a43f5e6 Mon Sep 17 00:00:00 2001 From: Yousef Mohsen Date: Fri, 16 Feb 2024 11:21:09 +0100 Subject: [PATCH 2/2] remove checks --- src/lib/api/universe.fragments.js | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/lib/api/universe.fragments.js b/src/lib/api/universe.fragments.js index f67294053..75525b55d 100644 --- a/src/lib/api/universe.fragments.js +++ b/src/lib/api/universe.fragments.js @@ -77,10 +77,6 @@ export function universeContent({ key, workType, offset, limit }) { } export function universesBasicInfoByWork({ workId }) { - if (workId) { - return null; - } - return { apiUrl: ApiEnums.FBI_API, query: `query UniversesBasicInfoByWork($workId: String!) { @@ -100,10 +96,6 @@ export function universesBasicInfoByWork({ workId }) { } export function universesByWork({ workId, offset, limit }) { - if (workId) { - return null; - } - return { apiUrl: ApiEnums.FBI_API, query: `query UniversesByWork($workId: String!, $offset: Int, $limit: Int) {