Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

521 B
Raw Blame
import { logger } from '@librechat/data-schemas';
import type { Request, Response } from 'express';

/** Safe to reuse with .replace() at module scope - does not retain lastIndex state */
// eslint-disable-next-line no-control-regex
const unsafeChars = /[\r\n\u0000]/g;

export function apiNotFound(req: Request, res: Response): void {
  const safePath = req.path.replace(unsafeChars, '_').slice(0, 200);
  logger.debug(`[API 404] ${req.method} ${safePath}`);
  res.status(404).json({ message: 'Endpoint not found' });
}