From 56fb028855097b610b87e578aff2bbfca3086f4e Mon Sep 17 00:00:00 2001 From: mattyatea Date: Sat, 23 Dec 2023 10:44:13 +0900 Subject: [PATCH] =?UTF-8?q?=E5=A4=9A=E5=88=86=E5=8B=95=E3=81=8F=E3=81=A8?= =?UTF-8?q?=E6=80=9D=E3=81=86=E3=81=8B=E3=82=89=E3=83=AA=E3=83=AA=E3=83=BC?= =?UTF-8?q?=E3=82=B9=E3=81=97=E3=82=88=E3=81=86=E3=81=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/server/api/endpoints/admin/emoji/add-request.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/add-request.ts b/packages/backend/src/server/api/endpoints/admin/emoji/add-request.ts index 3818cd044a..b10f7d088d 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/add-request.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/add-request.ts @@ -67,9 +67,14 @@ export default class extends Endpoint { if (isDuplicate || isRequestDuplicate) throw new ApiError(meta.errors.duplicateName); let driveFile; - driveFile = await this.driveFilesRepository.findOneBy({ id: ps.fileId }); - if (driveFile == null) throw new ApiError(meta.errors.noSuchFile); + let tmp = await this.driveFilesRepository.findOneBy({ id: ps.fileId }); + if (tmp == null) throw new ApiError(meta.errors.noSuchFile); + try { + driveFile = await this.driveService.uploadFromUrl({ url: tmp.url , user: null, force: true }); + } catch (e) { + throw new ApiError(); + } if (driveFile == null) throw new ApiError(meta.errors.noSuchFile); const {ApiBase,EmojiBotToken,DiscordWebhookUrl,requestEmojiAllOk} = (await this.metaService.fetch()) let emoji;