summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzyoshoka <107108195+zyoshoka@users.noreply.github.com>2025-01-18 13:05:33 +0900
committerGitHub <noreply@github.com>2025-01-18 04:05:33 +0000
commit1ef62e9e335d5875a8901d13f70c3cf386bba303 (patch)
tree1015e5818b0ea0caef6d21eb53ca734971f646b9
parentfix(backend): localOnlyなノートの時は配送処理そのものを起動... (diff)
downloadsharkey-1ef62e9e335d5875a8901d13f70c3cf386bba303.tar.gz
sharkey-1ef62e9e335d5875a8901d13f70c3cf386bba303.tar.bz2
sharkey-1ef62e9e335d5875a8901d13f70c3cf386bba303.zip
fix(backend): clone schema before converting to OAS schema to avoid mutation (#15294)
* fix(backend): clone schema before converting to OAS schema to avoid mutation * Update CHANGELOG.md * fix: use deepClone
-rw-r--r--CHANGELOG.md1
-rw-r--r--packages/backend/src/server/api/openapi/schemas.ts4
2 files changed, 4 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 28bfe64ecd..cc84130d5b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -59,6 +59,7 @@
- Fix: AIセンシティブ判定が arm64 環境で動作しない問題を修正
- Fix: 非Misskey系のソフトウェアからHTML`<ruby>`タグを含むノートを受信した場合、MFMの読み仮名(ルビ)文法に変換して表示
- Fix: 連合OFFで投稿されたノートに対する冗長な処理を抑止 ( #15018 )
+- Fix: `/api.json`のレスポンスが2回目のリクエスト以降おかしくなる問題を修正
### Misskey.js
- Feat: allow setting `binaryType` of WebSocket connection
diff --git a/packages/backend/src/server/api/openapi/schemas.ts b/packages/backend/src/server/api/openapi/schemas.ts
index eb854a7141..c80dda8d96 100644
--- a/packages/backend/src/server/api/openapi/schemas.ts
+++ b/packages/backend/src/server/api/openapi/schemas.ts
@@ -3,13 +3,15 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
+import { deepClone } from '@/misc/clone.js';
import type { Schema } from '@/misc/json-schema.js';
import { refs } from '@/misc/json-schema.js';
export function convertSchemaToOpenApiSchema(schema: Schema, type: 'param' | 'res', includeSelfRef: boolean): any {
// optional, nullable, refはスキーマ定義に含まれないので分離しておく
// eslint-disable-next-line @typescript-eslint/no-unused-vars
- const { optional, nullable, ref, selfRef, ...res }: any = schema;
+ const { optional, nullable, ref, selfRef, ..._res }: any = schema;
+ const res = deepClone(_res);
if (schema.type === 'object' && schema.properties) {
if (type === 'res') {