Merge pull request #38 from calcom/fix/else

pull/9078/head
Agusti Fernandez 2022-04-15 16:57:00 +02:00 committed by GitHub
commit b06af91152
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -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);