From 7e9c38d6fbdab1691056f411787801d87701c593 Mon Sep 17 00:00:00 2001 From: taichan <40626578+tai-cha@users.noreply.github.com> Date: Tue, 30 Jul 2024 15:29:24 +0900 Subject: [PATCH] =?UTF-8?q?Fix(backend):=20=E3=83=89=E3=83=A9=E3=82=A4?= =?UTF-8?q?=E3=83=96=E3=81=AE=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB=E3=81=AE?= =?UTF-8?q?url,=20uri,=20src=20=E3=81=AE=E4=B8=8A=E9=99=90=E5=BC=95?= =?UTF-8?q?=E3=81=8D=E4=B8=8A=E3=81=92=20=20(#14323)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * enhance: ドライブurlの上限文字数を引き上げ * Fix: おそらくフォーク独自の変更のように見える部分(metaに関する変更部分)を削除 * UPDATE changelog * Add SPDX prefixes * Fix: インデックスの張り直しを消した --------- Co-authored-by: slofp --- CHANGELOG.md | 5 ++++ .../migration/1721666053703-fixDriveUrl.js | 24 +++++++++++++++++++ packages/backend/src/models/DriveFile.ts | 6 ++--- 3 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 packages/backend/migration/1721666053703-fixDriveUrl.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 17cf4d3275..33256a8674 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -88,6 +88,11 @@ - Fix: リノートのミュートが適用されるまでに時間がかかることがある問題を修正 (Cherry-picked from https://github.com/Type4ny-Project/Type4ny/commit/e9601029b52e0ad43d9131b555b614e56c84ebc1) - Fix: Steaming APIが不正なデータを受けた場合の動作が不安定である問題 #14251 +- Fix: 一部のMisskey以外のソフトウェアからファイルを受け取れない問題 + (Cherry-picked from https://github.com/Secineralyr/misskey.dream/pull/73/commits/652eaff1e8aa00b890d71d2e1e52c263c1e67c76) + - NOTE: `drive_file`の`url`, `uri`, `src`の上限が512から1024に変更されます + Migrationではカラム定義の変更のみが行われます。 + サーバー管理者は各サーバーの必要に応じ`drive_file` `("uri")`に対するインデックスを張りなおすことでより安定しDBの探索が行われる可能性があります。詳細 は [GitHub](https://github.com/misskey-dev/misskey/pull/14323#issuecomment-2257562228)で確認可能です ### Misskey.js - Feat: `/drive/files/create` のリクエストに対応(`multipart/form-data`に対応) diff --git a/packages/backend/migration/1721666053703-fixDriveUrl.js b/packages/backend/migration/1721666053703-fixDriveUrl.js new file mode 100644 index 0000000000..d8512fb835 --- /dev/null +++ b/packages/backend/migration/1721666053703-fixDriveUrl.js @@ -0,0 +1,24 @@ +/* + * SPDX-FileCopyrightText: syuilo and misskey-project + * SPDX-License-Identifier: AGPL-3.0-only + */ + +export class FixDriveUrl1721666053703 { + name = 'FixDriveUrl1721666053703' + + async up(queryRunner) { + await queryRunner.query(`ALTER TABLE "drive_file" ALTER COLUMN "url" TYPE character varying(1024), ALTER COLUMN "url" SET NOT NULL`); + await queryRunner.query(`COMMENT ON COLUMN "drive_file"."url" IS 'The URL of the DriveFile.'`); + await queryRunner.query(`ALTER TABLE "drive_file" ALTER COLUMN "uri" TYPE character varying(1024)`); + await queryRunner.query(`COMMENT ON COLUMN "drive_file"."uri" IS 'The URI of the DriveFile. it will be null when the DriveFile is local.'`); + await queryRunner.query(`ALTER TABLE "drive_file" ALTER COLUMN "src" TYPE character varying(1024)`); + } + + async down(queryRunner) { + await queryRunner.query(`ALTER TABLE "drive_file" ALTER COLUMN "src" TYPE character varying(512)`); + await queryRunner.query(`COMMENT ON COLUMN "drive_file"."uri" IS 'The URI of the DriveFile. it will be null when the DriveFile is local.'`); + await queryRunner.query(`ALTER TABLE "drive_file" ALTER COLUMN "uri" TYPE character varying(512)`); + await queryRunner.query(`COMMENT ON COLUMN "drive_file"."url" IS 'The URL of the DriveFile.'`); + await queryRunner.query(`ALTER TABLE "drive_file" ALTER COLUMN "url" TYPE character varying(512), ALTER COLUMN "url" SET NOT NULL`); + } +} diff --git a/packages/backend/src/models/DriveFile.ts b/packages/backend/src/models/DriveFile.ts index 438b32f79a..7b03e3e494 100644 --- a/packages/backend/src/models/DriveFile.ts +++ b/packages/backend/src/models/DriveFile.ts @@ -82,7 +82,7 @@ export class MiDriveFile { public storedInternal: boolean; @Column('varchar', { - length: 512, + length: 1024, comment: 'The URL of the DriveFile.', }) public url: string; @@ -124,13 +124,13 @@ export class MiDriveFile { @Index() @Column('varchar', { - length: 512, nullable: true, + length: 1024, nullable: true, comment: 'The URI of the DriveFile. it will be null when the DriveFile is local.', }) public uri: string | null; @Column('varchar', { - length: 512, nullable: true, + length: 1024, nullable: true, }) public src: string | null;