Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

Title presence check

Blue Mousea865e3821a83
diff --git a/backend/apps/production/src/og-image/og-image.controller.ts b/backend/apps/production/src/og-image/og-image.controller.ts
index 809958f1b..1d687d742 100644
--- a/backend/apps/production/src/og-image/og-image.controller.ts
+++ b/backend/apps/production/src/og-image/og-image.controller.ts
@@ -1,4 +1,11 @@
-import { Controller, Query, Get, Header, Res } from '@nestjs/common'
+import {
+ Controller,
+ Query,
+ Get,
+ Header,
+ Res,
+ BadRequestException,
+} from '@nestjs/common'
import { ApiTags, ApiQuery, ApiResponse } from '@nestjs/swagger'
import { Response } from 'express'
@@ -29,6 +36,10 @@ export class OgImageController {
): Promise<any> {
this.logger.log({ title }, 'GET /og-image')
+ if (!title || typeof title !== 'string') {
+ throw new BadRequestException('Title is required')
+ }
+
const image = await this.ogImageService.getOgImage(title)
res.end(image)