From c4e8cabae90b59d5842db2f789eb0cd8ee1fcac4 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 20 Oct 2018 15:50:13 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB=E4=BD=9C?= =?UTF-8?q?=E6=88=90API=E3=81=ABforce=E3=82=AA=E3=83=97=E3=82=B7=E3=83=A7?= =?UTF-8?q?=E3=83=B3=E3=82=92=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/api/endpoints/drive/files/create.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/server/api/endpoints/drive/files/create.ts b/src/server/api/endpoints/drive/files/create.ts index 4b5ffa90e0..29e65a7ad3 100644 --- a/src/server/api/endpoints/drive/files/create.ts +++ b/src/server/api/endpoints/drive/files/create.ts @@ -31,19 +31,23 @@ export const meta = { } }), - isSensitive: $.bool.optional.nullable.note({ - default: null, + isSensitive: $.bool.optional.note({ + default: false, desc: { 'ja-JP': 'このメディアが「閲覧注意」(NSFW)かどうか', 'en-US': 'Whether this media is NSFW' } + }), + + force: $.bool.optional.note({ + default: false, + desc: { + 'ja-JP': 'true にすると、同じハッシュを持つファイルが既にアップロードされていても強制的にファイルを作成します。', + } }) } }; -/** - * Create a file - */ export default async (file: any, params: any, user: ILocalUser): Promise => { if (file == null) { throw 'file is required'; @@ -76,7 +80,7 @@ export default async (file: any, params: any, user: ILocalUser): Promise => try { // Create file - const driveFile = await create(user, file.path, name, null, ps.folderId, false, false, null, null, ps.isSensitive); + const driveFile = await create(user, file.path, name, null, ps.folderId, ps.force, false, null, null, ps.isSensitive); cleanup();