From 27053e7c8075c7ddea1cbd098357b2609d8894dd Mon Sep 17 00:00:00 2001 From: Agusti Fernandez Pardo Date: Wed, 18 May 2022 21:48:13 +0200 Subject: [PATCH 1/2] fix: dont replace cal_ --- lib/helpers/verifyApiKey.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/helpers/verifyApiKey.ts b/lib/helpers/verifyApiKey.ts index 6026106231..cf5c4a8472 100644 --- a/lib/helpers/verifyApiKey.ts +++ b/lib/helpers/verifyApiKey.ts @@ -23,10 +23,7 @@ export const dateNotInPast = function (date: Date) { export const verifyApiKey: NextMiddleware = async (req, res, next) => { if (!req.query.apiKey) return res.status(401).json({ message: "No apiKey provided" }); // We remove the prefix from the user provided api_key. If no env set default to "cal_" - let strippedApiKey = `${req.query.apiKey}`.replace(process.env.API_KEY_PREFIX, ""); - strippedApiKey = strippedApiKey.includes("cal_") - ? strippedApiKey.replace("cal_", "") - : strippedApiKey; + const strippedApiKey = `${req.query.apiKey}`.replace(process.env.API_KEY_PREFIX || "cal_", ""); // Hash the key again before matching against the database records. const hashedKey = hashAPIKey(strippedApiKey); // Check if the hashed api key exists in database. From df16126a49ccd8af5ba92ba9978fbab59ede2e4b Mon Sep 17 00:00:00 2001 From: Agusti Fernandez Pardo Date: Wed, 18 May 2022 21:50:34 +0200 Subject: [PATCH 2/2] fix: object or null instead of json for extends event-types --- lib/types.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/types.ts b/lib/types.ts index 574e164e29..13670a0408 100644 --- a/lib/types.ts +++ b/lib/types.ts @@ -125,9 +125,9 @@ export type EventTypeCustomInputsResponse = BaseResponse & { event_type_custom_inputs?: Partial[]; }; export interface EventTypeMeta extends Omit { - locations?: JSON; - metadata?: JSON; - recurringEvent: JSON; + locations: object | null; + metadata: object | null; + recurringEvent: object | null; } // EventType export type EventTypeResponse = BaseResponse & {