Skip to content

Commit

Permalink
Fix: Continue importing from file if single emoji import fails
Browse files Browse the repository at this point in the history
  • Loading branch information
winrg committed Aug 25, 2024
1 parent 44f6216 commit ed894ef
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 18 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

### Server
- ファイルがサイズの制限を超えてアップロードされた際にエラーを返さなかった問題を修正

- Fix: Continue importing from file if single emoji import fails

## 2024.8.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,23 +87,30 @@ export class ImportCustomEmojisProcessorService {
await this.emojisRepository.delete({
name: emojiInfo.name,
});
const driveFile = await this.driveService.addFile({
user: null,
path: emojiPath,
name: record.fileName,
force: true,
});
await this.customEmojiService.add({
name: emojiInfo.name,
category: emojiInfo.category,
host: null,
aliases: emojiInfo.aliases,
driveFile,
license: emojiInfo.license,
isSensitive: emojiInfo.isSensitive,
localOnly: emojiInfo.localOnly,
roleIdsThatCanBeUsedThisEmojiAsReaction: [],
});
try {
const driveFile = await this.driveService.addFile({
user: null,
path: emojiPath,
name: record.fileName,
force: true,
});
await this.customEmojiService.add({
name: emojiInfo.name,
category: emojiInfo.category,
host: null,
aliases: emojiInfo.aliases,
driveFile,
license: emojiInfo.license,
isSensitive: emojiInfo.isSensitive,
localOnly: emojiInfo.localOnly,
roleIdsThatCanBeUsedThisEmojiAsReaction: [],
});
} catch (e) {
if (e instanceof Error || typeof e === 'string') {
this.logger.error(`couldn't import ${emojiPath} for ${emojiInfo.name}: ${e}`);
}
continue;
}
}

cleanup();
Expand Down

0 comments on commit ed894ef

Please sign in to comment.