mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-10 00:31:22 +00:00
fix: tighten Teams and device typing
This commit is contained in:
@@ -39,18 +39,23 @@ import {
|
||||
wasMSTeamsBotMentioned,
|
||||
} from "../inbound.js";
|
||||
|
||||
function isStringRecord(value: unknown): value is Record<string, string> {
|
||||
return typeof value === "object" && value !== null;
|
||||
}
|
||||
|
||||
function extractTextFromHtmlAttachments(attachments: MSTeamsAttachmentLike[]): string {
|
||||
for (const attachment of attachments) {
|
||||
if (attachment.contentType !== "text/html") {
|
||||
continue;
|
||||
}
|
||||
const structuredContent = isStringRecord(attachment.content) ? attachment.content : null;
|
||||
const raw =
|
||||
typeof attachment.content === "string"
|
||||
? attachment.content
|
||||
: typeof attachment.content?.text === "string"
|
||||
? attachment.content.text
|
||||
: typeof attachment.content?.body === "string"
|
||||
? attachment.content.body
|
||||
: typeof structuredContent?.text === "string"
|
||||
? structuredContent.text
|
||||
: typeof structuredContent?.body === "string"
|
||||
? structuredContent.body
|
||||
: "";
|
||||
if (!raw) {
|
||||
continue;
|
||||
|
||||
@@ -29,7 +29,7 @@ import type { GatewayRequestHandlers } from "./types.js";
|
||||
const DEVICE_TOKEN_ROTATION_DENIED_MESSAGE = "device token rotation denied";
|
||||
|
||||
type DeviceTokenRotateTarget = {
|
||||
pairedDevice: Awaited<ReturnType<typeof getPairedDevice>>;
|
||||
pairedDevice: NonNullable<Awaited<ReturnType<typeof getPairedDevice>>>;
|
||||
normalizedRole: string;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user