summaryrefslogtreecommitdiff
path: root/packages/backend/src/server/api/endpoints/clips
diff options
context:
space:
mode:
authorかっこかり <67428053+kakkokari-gtyih@users.noreply.github.com>2025-02-26 10:27:38 +0900
committerGitHub <noreply@github.com>2025-02-26 01:27:38 +0000
commitb5799351d061d92e71f5f95241bac0939eaf20c9 (patch)
tree4e15169f8f0d31aca0ab99b985cfbb8fbcc8b14e /packages/backend/src/server/api/endpoints/clips
parentBump version to 2025.2.1-beta.1 (diff)
downloadsharkey-b5799351d061d92e71f5f95241bac0939eaf20c9.tar.gz
sharkey-b5799351d061d92e71f5f95241bac0939eaf20c9.tar.bz2
sharkey-b5799351d061d92e71f5f95241bac0939eaf20c9.zip
fix(backend): clips/updateのdescriptionで空文字を許容するように (#15429)
* fix(backend): clips/updateのdescriptionで空文字を許容するように * Update Changelog * fix: createの際も空文字を許容するように * fix test * fix test --------- Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
Diffstat (limited to 'packages/backend/src/server/api/endpoints/clips')
-rw-r--r--packages/backend/src/server/api/endpoints/clips/create.ts6
-rw-r--r--packages/backend/src/server/api/endpoints/clips/update.ts6
2 files changed, 8 insertions, 4 deletions
diff --git a/packages/backend/src/server/api/endpoints/clips/create.ts b/packages/backend/src/server/api/endpoints/clips/create.ts
index ceebc8ba5e..b40706297d 100644
--- a/packages/backend/src/server/api/endpoints/clips/create.ts
+++ b/packages/backend/src/server/api/endpoints/clips/create.ts
@@ -39,7 +39,7 @@ export const paramDef = {
properties: {
name: { type: 'string', minLength: 1, maxLength: 100 },
isPublic: { type: 'boolean', default: false },
- description: { type: 'string', nullable: true, minLength: 1, maxLength: 2048 },
+ description: { type: 'string', nullable: true, maxLength: 2048 },
},
required: ['name'],
} as const;
@@ -53,7 +53,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
super(meta, paramDef, async (ps, me) => {
let clip: MiClip;
try {
- clip = await this.clipService.create(me, ps.name, ps.isPublic, ps.description ?? null);
+ // 空文字列をnullにしたいので??は使わない
+ // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
+ clip = await this.clipService.create(me, ps.name, ps.isPublic, ps.description || null);
} catch (e) {
if (e instanceof ClipService.TooManyClipsError) {
throw new ApiError(meta.errors.tooManyClips);
diff --git a/packages/backend/src/server/api/endpoints/clips/update.ts b/packages/backend/src/server/api/endpoints/clips/update.ts
index 603a3ccf3d..6ff3f9aada 100644
--- a/packages/backend/src/server/api/endpoints/clips/update.ts
+++ b/packages/backend/src/server/api/endpoints/clips/update.ts
@@ -39,7 +39,7 @@ export const paramDef = {
clipId: { type: 'string', format: 'misskey:id' },
name: { type: 'string', minLength: 1, maxLength: 100 },
isPublic: { type: 'boolean' },
- description: { type: 'string', nullable: true, minLength: 1, maxLength: 2048 },
+ description: { type: 'string', nullable: true, maxLength: 2048 },
},
required: ['clipId'],
} as const;
@@ -53,7 +53,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
) {
super(meta, paramDef, async (ps, me) => {
try {
- await this.clipService.update(me, ps.clipId, ps.name, ps.isPublic, ps.description);
+ // 空文字列をnullにしたいので??は使わない
+ // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
+ await this.clipService.update(me, ps.clipId, ps.name, ps.isPublic, ps.description || null);
} catch (e) {
if (e instanceof ClipService.NoSuchClipError) {
throw new ApiError(meta.errors.noSuchClip);