Skip to content

Scheduling infrastructure for absolutely everyone.

add else if to api key request

Agusti Fernandez Pardoca8ca913a8c0
diff --git a/lib/helpers/verifyApiKey.ts b/lib/helpers/verifyApiKey.ts
index 653d8067eee..9a40ce5f25e 100644
--- a/lib/helpers/verifyApiKey.ts
+++ b/lib/helpers/verifyApiKey.ts
@@ -15,7 +15,7 @@ const today = new Date();
export const verifyApiKey: NextMiddleware = async (req, res, next) => {
const pathIsDocs = req.url?.startsWith("/docs");
if (pathIsDocs) await next();
- if (!req.query.apiKey) res.status(401).json({ message: "No API key provided" });
+ else if (!req.query.apiKey) res.status(401).json({ message: "No API key provided" });
const strippedApiKey = `${req.query.apiKey}`.replace(process.env.API_KEY_PREFIX || "cal_", "");
const hashedKey = hashAPIKey(strippedApiKey);