diff --git a/packages/backend/src/services/drive/add-file.ts b/packages/backend/src/services/drive/add-file.ts index 70c138965..81da49df8 100644 --- a/packages/backend/src/services/drive/add-file.ts +++ b/packages/backend/src/services/drive/add-file.ts @@ -384,7 +384,7 @@ export async function addFile({ if (Users.isLocalUser(user)) { throw new Error('no-free-space'); } else { - // (アバターまたはバナーを含まず)最も古いファイルを削除する + // delete oldest file (excluding banner and avatar) deleteOldFile(await Users.findOneByOrFail({ id: user.id }) as IRemoteUser); } } diff --git a/packages/backend/src/services/drive/delete-file.ts b/packages/backend/src/services/drive/delete-file.ts index 624fada32..2fe8993a8 100644 --- a/packages/backend/src/services/drive/delete-file.ts +++ b/packages/backend/src/services/drive/delete-file.ts @@ -64,27 +64,27 @@ export async function deleteFileSync(file: DriveFile, isExpired = false): Promis } async function postProcess(file: DriveFile, isExpired = false): Promise { - // リモートファイル期限切れ削除後は直リンクにする - if (isExpired && file.userHost !== null && file.uri != null) { + // Turn into a direct link after expiring a remote file. + if (isExpired && file.userHost != null && file.uri != null) { + const id = uuid(); DriveFiles.update(file.id, { isLink: true, url: file.uri, thumbnailUrl: null, webpublicUrl: null, storedInternal: false, - // ローカルプロキシ用 - accessKey: uuid(), - thumbnailAccessKey: 'thumbnail-' + uuid(), - webpublicAccessKey: 'webpublic-' + uuid(), + accessKey: id, + thumbnailAccessKey: 'thumbnail-' + id, + webpublicAccessKey: 'webpublic-' + id, }); } else { DriveFiles.delete(file.id); } - // 統計を更新 + // update statistics driveChart.update(file, false); perUserDriveChart.update(file, false); - if (file.userHost !== null) { + if (file.userHost != null) { instanceChart.updateDrive(file, false); } }