diff options
| author | Aleteoryx <45829905+winrg@users.noreply.github.com> | 2024-09-23 20:50:00 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-24 09:50:00 +0900 |
| commit | 689848943b4a1ec31d05870936d104703a0cc6a4 (patch) | |
| tree | 32ad0c80b23771d7b3ef0429ab5bddc00aefaf6b /packages/backend/src/queue | |
| parent | fix(frontend): weird AP delivered chart in control panel (#14481) (diff) | |
| download | sharkey-689848943b4a1ec31d05870936d104703a0cc6a4.tar.gz sharkey-689848943b4a1ec31d05870936d104703a0cc6a4.tar.bz2 sharkey-689848943b4a1ec31d05870936d104703a0cc6a4.zip | |
Fix: Continue importing from file if single emoji import fails (#14461)
* Fix: Continue importing from file if single emoji import fails
* Fix indentation
---------
Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com>
Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
Diffstat (limited to 'packages/backend/src/queue')
| -rw-r--r-- | packages/backend/src/queue/processors/ImportCustomEmojisProcessorService.ts | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/packages/backend/src/queue/processors/ImportCustomEmojisProcessorService.ts b/packages/backend/src/queue/processors/ImportCustomEmojisProcessorService.ts index 171809d25c..9e1b8fee70 100644 --- a/packages/backend/src/queue/processors/ImportCustomEmojisProcessorService.ts +++ b/packages/backend/src/queue/processors/ImportCustomEmojisProcessorService.ts @@ -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(); |