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;