server: fix wrong emoji regex in backend
Some checks failed
ci/woodpecker/push/lint-client Pipeline failed
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/lint-sw Pipeline failed
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/lint-backend Pipeline failed
ci/woodpecker/push/test Pipeline failed

Changelog: Fixed
This commit is contained in:
Johann150 2024-01-04 17:43:05 +01:00
parent 86565cd25b
commit 3968a6ca07
Signed by: Johann150
GPG key ID: 9EE6577A2A06F8F1

View file

@ -44,12 +44,10 @@ function normalizeHost(src: string | undefined, noteUserHost: string | null): st
}
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 };
}