fix(signal): remove stale 'unknown' MediaKind comparisons
kindFromMime() returns MediaKind | undefined, never the string 'unknown'. The old guard against <media:unknown> was based on prior behavior that no longer exists. Simplify to: use <media:> when kind is defined, fall back to <media:attachment> when attachments are present but mime is unresolvable, and emit nothing for blank envelopes.
This commit is contained in:
parent
292a8ef9c4
commit
f14ea9f77f
@ -862,13 +862,12 @@ export function createSignalEventHandler(deps: SignalEventHandlerDeps) {
|
||||
placeholder = formatAttachmentSummaryPlaceholder(mediaTypes);
|
||||
} else {
|
||||
// Only set placeholder when we actually resolved a mediaType.
|
||||
// kindFromMime(undefined) returns "unknown" which is truthy — guard against
|
||||
// that case so null-body messages (e.g. blank reaction envelopes) aren't dispatched
|
||||
// with <media:unknown> as the body.
|
||||
// Guard against undefined kind (e.g. blank reaction envelopes) so null-body
|
||||
// messages aren't dispatched with a spurious <media:…> body.
|
||||
const kind = mediaType ? kindFromMime(mediaType) : undefined;
|
||||
if (kind && kind !== "unknown") {
|
||||
if (kind) {
|
||||
placeholder = `<media:${kind}>`;
|
||||
} else if (kind === "unknown" || (!kind && dataMessage.attachments?.length)) {
|
||||
} else if (dataMessage.attachments?.length) {
|
||||
placeholder = "<media:attachment>";
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user