fix: text is undefined in masto status api

This commit is contained in:
Mar0xy 2023-09-25 02:03:16 +02:00
parent 25e5256fe6
commit 806a76c5ca
No known key found for this signature in database
GPG Key ID: 56569BBE47D2C828

View File

@ -156,7 +156,7 @@ export class ApiStatusMastodon {
) { ) {
body = normalizeQuery(body); body = normalizeQuery(body);
} }
const text = body.status; const text = body.status ? body.status : '';
const removed = text.replace(/@\S+/g, '').replace(/\s|/g, ''); const removed = text.replace(/@\S+/g, '').replace(/\s|/g, '');
const isDefaultEmoji = emojiRegexAtStartToEnd.test(removed); const isDefaultEmoji = emojiRegexAtStartToEnd.test(removed);
const isCustomEmoji = /^:[a-zA-Z0-9@_]+:$/.test(removed); const isCustomEmoji = /^:[a-zA-Z0-9@_]+:$/.test(removed);