diff --git a/packages/backend/src/misc/populate-emojis.ts b/packages/backend/src/misc/populate-emojis.ts index 870dff5cf..b2488e66f 100644 --- a/packages/backend/src/misc/populate-emojis.ts +++ b/packages/backend/src/misc/populate-emojis.ts @@ -41,13 +41,10 @@ function normalizeHost( } function parseEmojiStr(emojiName: string, noteUserHost: string | null) { - const match = emojiName.match(/^(\w+)(?:@([\w.-]+))?$/); - if (!match) return { name: null, host: null }; - - const name = match[1]; - - // ホスト正規化 - const host = toPunyNullable(normalizeHost(match[2], noteUserHost)); + // emojiName may be of the form `emoji@host`, turn it into a suitable form + const match = emojiName.split("@"); + const name = match[0]; + const host = toPunyNullable(normalizeHost(match[1], noteUserHost)); return { name, host }; } diff --git a/packages/backend/src/queue/processors/db/export-custom-emojis.ts b/packages/backend/src/queue/processors/db/export-custom-emojis.ts index 7a19d0b60..1374d6c4e 100644 --- a/packages/backend/src/queue/processors/db/export-custom-emojis.ts +++ b/packages/backend/src/queue/processors/db/export-custom-emojis.ts @@ -68,7 +68,9 @@ export async function exportCustomEmojis( for (const emoji of customEmojis) { const ext = mime.extension(emoji.type); - const fileName = emoji.name + (ext ? `.${ext}` : ""); + // there are some restrictions on file names, so to be safe the files are + // named after their database id instead of the actual emoji name + const fileName = emoji.id + (ext ? '.' + ext : ''); const emojiPath = `${path}/${fileName}`; fs.writeFileSync(emojiPath, "", "binary"); let downloaded = false;