refactor, enhance: ドライブ引数のオブジェクト化, 追加時のcomment指定 (#8180)
* refactor: ドライブの引数をオブジェクト化する Resolve #8177 * Resolve #8181 * fix * archivePath
This commit is contained in:
@@ -6,6 +6,7 @@ import define from '../../../define';
|
||||
import { apiLogger } from '../../../logger';
|
||||
import { ApiError } from '../../../error';
|
||||
import { DriveFiles } from '@/models/index';
|
||||
import { DB_MAX_IMAGE_COMMENT_LENGTH } from '@/misc/hard-limits';
|
||||
|
||||
export const meta = {
|
||||
tags: ['drive'],
|
||||
@@ -32,6 +33,11 @@ export const meta = {
|
||||
default: null,
|
||||
},
|
||||
|
||||
comment: {
|
||||
validator: $.optional.nullable.str.max(DB_MAX_IMAGE_COMMENT_LENGTH),
|
||||
default: null,
|
||||
},
|
||||
|
||||
isSensitive: {
|
||||
validator: $.optional.either($.bool, $.str),
|
||||
default: false,
|
||||
@@ -79,7 +85,7 @@ export default define(meta, async (ps, user, _, file, cleanup) => {
|
||||
|
||||
try {
|
||||
// Create file
|
||||
const driveFile = await addFile(user, file.path, name, null, ps.folderId, ps.force, false, null, null, ps.isSensitive);
|
||||
const driveFile = await addFile({ user, path: file.path, name, comment: ps.comment, folderId: ps.folderId, force: ps.force, sensitive: ps.isSensitive });
|
||||
return await DriveFiles.pack(driveFile, { self: true });
|
||||
} catch (e) {
|
||||
apiLogger.error(e);
|
||||
|
Reference in New Issue
Block a user