From 63068fc0c2666eae5e78572e814bf327a8e246d8 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 15 Mar 2023 18:09:00 +0900 Subject: [PATCH] fix(server): prevent creation of empty antennas --- CHANGELOG.md | 1 + packages/backend/src/server/api/endpoints/antennas/create.ts | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 27d72388ac..aeab25522e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,7 @@ You should also include the user name that made the change. - Bookwyrmのユーザーのプロフィールページで「リモートで表示」をタップしても反応がない問題を修正 - `disableCache: true`を設定している場合に絵文字管理操作でエラーが出る問題を修正 - リテンション分析が上手く機能しないことがあるのを修正 +- 空のアンテナが作成できないように修正 ## 13.9.2 (2023/03/06) diff --git a/packages/backend/src/server/api/endpoints/antennas/create.ts b/packages/backend/src/server/api/endpoints/antennas/create.ts index bc5d249ae5..b57906a688 100644 --- a/packages/backend/src/server/api/endpoints/antennas/create.ts +++ b/packages/backend/src/server/api/endpoints/antennas/create.ts @@ -79,6 +79,10 @@ export default class extends Endpoint { private globalEventService: GlobalEventService, ) { super(meta, paramDef, async (ps, me) => { + if (ps.keywords.length === 0) { + throw new Error('invalid param'); + } + const currentAntennasCount = await this.antennasRepository.countBy({ userId: me.id, });