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!

fix: Filter out blank brand keywords before serializing them

Blue Mouse0f0f217751a4
diff --git a/backend/apps/cloud/src/project/project.controller.ts b/backend/apps/cloud/src/project/project.controller.ts
index 758fe3b53..983d0ccfe 100644
--- a/backend/apps/cloud/src/project/project.controller.ts
+++ b/backend/apps/cloud/src/project/project.controller.ts
@@ -1806,11 +1806,12 @@ export class ProjectController {
}
if (projectDTO.brandKeywords !== undefined) {
+ const trimmed = Array.isArray(projectDTO.brandKeywords)
+ ? projectDTO.brandKeywords.map((k) => _trim(k)).filter(Boolean)
+ : []
+
project.brandKeywords =
- Array.isArray(projectDTO.brandKeywords) &&
- projectDTO.brandKeywords.length > 0
- ? JSON.stringify(projectDTO.brandKeywords.map((k) => _trim(k)))
- : null
+ trimmed.length > 0 ? JSON.stringify(trimmed) : null
}
await this.projectService.update({ id }, _omit(project, ['share', 'admin']))