merge: increase comment length for files (#45)

This commit is contained in:
Marie 2023-10-02 15:03:17 +02:00 committed by GitHub
commit 64622b5f9a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 4 deletions

View file

@ -0,0 +1,12 @@
export class largerImageComment1680969937000 {
name = 'largerImageComment1680969937000';
async up(queryRunner) {
await queryRunner.query(`ALTER TABLE "drive_file" ALTER COLUMN "comment" TYPE character varying(8192)`, undefined);
}
async down(queryRunner) {
await queryRunner.query(`ALTER TABLE "drive_file" ALTER COLUMN "comment" TYPE character varying(512)`, undefined);
}
}

View file

@ -21,7 +21,7 @@ export const DB_MAX_NOTE_TEXT_LENGTH = 8192;
* Maximum image description length that can be stored in DB. * Maximum image description length that can be stored in DB.
* Surrogate pairs count as one * Surrogate pairs count as one
*/ */
export const DB_MAX_IMAGE_COMMENT_LENGTH = 512; export const DB_MAX_IMAGE_COMMENT_LENGTH = 8192;
//#endregion //#endregion
// ブラウザで直接表示することを許可するファイルの種類のリスト // ブラウザで直接表示することを許可するファイルの種類のリスト

View file

@ -67,7 +67,8 @@ export class MiDriveFile {
public size: number; public size: number;
@Column('varchar', { @Column('varchar', {
length: 512, nullable: true, length: 8192,
nullable: true,
comment: 'The comment of the DriveFile.', comment: 'The comment of the DriveFile.',
}) })
public comment: string | null; public comment: string | null;

View file

@ -10,6 +10,7 @@ import { DI } from '@/di-symbols.js';
import { RoleService } from '@/core/RoleService.js'; import { RoleService } from '@/core/RoleService.js';
import { DriveService } from '@/core/DriveService.js'; import { DriveService } from '@/core/DriveService.js';
import { ApiError } from '../../../error.js'; import { ApiError } from '../../../error.js';
import { DB_MAX_IMAGE_COMMENT_LENGTH } from '@/const.js';
export const meta = { export const meta = {
tags: ['drive'], tags: ['drive'],
@ -65,7 +66,7 @@ export const paramDef = {
folderId: { type: 'string', format: 'misskey:id', nullable: true }, folderId: { type: 'string', format: 'misskey:id', nullable: true },
name: { type: 'string' }, name: { type: 'string' },
isSensitive: { type: 'boolean' }, isSensitive: { type: 'boolean' },
comment: { type: 'string', nullable: true, maxLength: 512 }, comment: { type: 'string', nullable: true, maxLength: DB_MAX_IMAGE_COMMENT_LENGTH },
}, },
required: ['fileId'], required: ['fileId'],
} as const; } as const;

View file

@ -9,6 +9,7 @@ import { Endpoint } from '@/server/api/endpoint-base.js';
import { GlobalEventService } from '@/core/GlobalEventService.js'; import { GlobalEventService } from '@/core/GlobalEventService.js';
import { DriveFileEntityService } from '@/core/entities/DriveFileEntityService.js'; import { DriveFileEntityService } from '@/core/entities/DriveFileEntityService.js';
import { DriveService } from '@/core/DriveService.js'; import { DriveService } from '@/core/DriveService.js';
import { DB_MAX_IMAGE_COMMENT_LENGTH } from '@/const.js';
export const meta = { export const meta = {
tags: ['drive'], tags: ['drive'],
@ -33,7 +34,7 @@ export const paramDef = {
url: { type: 'string' }, url: { type: 'string' },
folderId: { type: 'string', format: 'misskey:id', nullable: true, default: null }, folderId: { type: 'string', format: 'misskey:id', nullable: true, default: null },
isSensitive: { type: 'boolean', default: false }, isSensitive: { type: 'boolean', default: false },
comment: { type: 'string', nullable: true, maxLength: 512, default: null }, comment: { type: 'string', nullable: true, maxLength: DB_MAX_IMAGE_COMMENT_LENGTH, default: null },
marker: { type: 'string', nullable: true, default: null }, marker: { type: 'string', nullable: true, default: null },
force: { type: 'boolean', default: false }, force: { type: 'boolean', default: false },
}, },