diff --git a/packages/backend/src/core/CustomEmojiService.ts b/packages/backend/src/core/CustomEmojiService.ts index 61cf811192..f0be952612 100644 --- a/packages/backend/src/core/CustomEmojiService.ts +++ b/packages/backend/src/core/CustomEmojiService.ts @@ -111,7 +111,8 @@ export class CustomEmojiService { if (emoji == null) return null; const isLocal = emoji.host == null; - const emojiUrl = emoji.publicUrl || emoji.originalUrl; // || emoji.originalUrl してるのは後方互換性のため + // || emoji.originalUrl してるのは後方互換性のため(publicUrlはstringなので??はだめ) + const emojiUrl = emoji.publicUrl || emoji.originalUrl; const url = emojiUrl; return { diff --git a/packages/backend/src/core/ReactionService.ts b/packages/backend/src/core/ReactionService.ts index 1775d54228..0c1c3d0a3b 100644 --- a/packages/backend/src/core/ReactionService.ts +++ b/packages/backend/src/core/ReactionService.ts @@ -161,7 +161,8 @@ export class ReactionService { reaction: decodedReaction.reaction, emoji: emoji != null ? { name: emoji.host ? `${emoji.name}@${emoji.host}` : `${emoji.name}@.`, - url: emoji.publicUrl ?? emoji.originalUrl, // || emoji.originalUrl してるのは後方互換性のため + // || emoji.originalUrl してるのは後方互換性のため(publicUrlはstringなので??はだめ) + url: emoji.publicUrl || emoji.originalUrl, } : null, userId: user.id, }); diff --git a/packages/backend/src/core/activitypub/ApRendererService.ts b/packages/backend/src/core/activitypub/ApRendererService.ts index 1800840ee9..29f216aa1d 100644 --- a/packages/backend/src/core/activitypub/ApRendererService.ts +++ b/packages/backend/src/core/activitypub/ApRendererService.ts @@ -172,7 +172,8 @@ export class ApRendererService { icon: { type: 'Image', mediaType: emoji.type ?? 'image/png', - url: emoji.publicUrl ?? emoji.originalUrl, // ?? emoji.originalUrl してるのは後方互換性のため + // || emoji.originalUrl してるのは後方互換性のため(publicUrlはstringなので??はだめ) + url: emoji.publicUrl || emoji.originalUrl, }, }; } diff --git a/packages/backend/src/core/entities/EmojiEntityService.ts b/packages/backend/src/core/entities/EmojiEntityService.ts index f9419c5398..f1c7ee9035 100644 --- a/packages/backend/src/core/entities/EmojiEntityService.ts +++ b/packages/backend/src/core/entities/EmojiEntityService.ts @@ -32,8 +32,8 @@ export class EmojiEntityService { name: emoji.name, category: emoji.category, host: emoji.host, - // ?? emoji.originalUrl してるのは後方互換性のため - url: opts.omitUrl ? undefined : (emoji.publicUrl ?? emoji.originalUrl), + // || emoji.originalUrl してるのは後方互換性のため(publicUrlはstringなので??はだめ) + url: opts.omitUrl ? undefined : (emoji.publicUrl || emoji.originalUrl), }; } diff --git a/packages/backend/src/server/web/ClientServerService.ts b/packages/backend/src/server/web/ClientServerService.ts index 83a30dbe0b..02b779d741 100644 --- a/packages/backend/src/server/web/ClientServerService.ts +++ b/packages/backend/src/server/web/ClientServerService.ts @@ -245,7 +245,8 @@ export class ClientServerService { reply.header('Content-Security-Policy', 'default-src \'none\'; style-src \'unsafe-inline\''); const url = new URL("/proxy/emoji.webp", this.config.url); - url.searchParams.set('url', emoji.publicUrl ?? emoji.originalUrl); // ?? emoji.originalUrl してるのは後方互換性のため + // || emoji.originalUrl してるのは後方互換性のため(publicUrlはstringなので??はだめ) + url.searchParams.set('url', emoji.publicUrl || emoji.originalUrl); url.searchParams.set('emoji', '1'); if ('static' in request.query) url.searchParams.set('static', '1');