fix: なんかアホみたいなバグfix
This commit is contained in:
parent
365b5eaa70
commit
0e5d164acc
|
@ -74,15 +74,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
if (emoji == null) {
|
if (emoji == null) {
|
||||||
throw new ApiError(meta.errors.noSuchEmoji);
|
throw new ApiError(meta.errors.noSuchEmoji);
|
||||||
}
|
}
|
||||||
|
|
||||||
let driveFile: MiDriveFile;
|
|
||||||
|
|
||||||
try {
|
|
||||||
// Create file
|
|
||||||
driveFile = await this.driveService.uploadFromUrl({ url: emoji.originalUrl, user: null, force: true });
|
|
||||||
} catch (e) {
|
|
||||||
throw new ApiError();
|
|
||||||
}
|
|
||||||
const existEmoji = await this.emojisRepository.exist({
|
const existEmoji = await this.emojisRepository.exist({
|
||||||
where: {
|
where: {
|
||||||
name: emoji.name,
|
name: emoji.name,
|
||||||
|
@ -92,6 +83,14 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
if (existEmoji) {
|
if (existEmoji) {
|
||||||
throw new ApiError(meta.errors.duplicationEmojiAdd);
|
throw new ApiError(meta.errors.duplicationEmojiAdd);
|
||||||
}
|
}
|
||||||
|
let driveFile: MiDriveFile;
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Create file
|
||||||
|
driveFile = await this.driveService.uploadFromUrl({ url: emoji.originalUrl, user: null, force: true });
|
||||||
|
} catch (e) {
|
||||||
|
throw new ApiError();
|
||||||
|
}
|
||||||
|
|
||||||
const copied = await this.emojisRepository.insert({
|
const copied = await this.emojisRepository.insert({
|
||||||
id: this.idService.genId(),
|
id: this.idService.genId(),
|
||||||
|
|
Loading…
Reference in New Issue