mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-10 00:31:22 +00:00
fix: address review — pin .xml alias in MIME_BY_EXT, hoist fallback above condition
- Pin '.xml': 'text/xml' in MIME_BY_EXT overrides to prevent application/xml from overwriting text/xml in the reversed map - Move mediaType ??= fallback above the if-guard in send-api.ts for clarity (avoids side-effect assignment inside condition)
This commit is contained in:
committed by
Marcus Castro
parent
5661bcebd1
commit
a1eae4d7ac
@@ -34,7 +34,8 @@ export function createWebSendApi(params: {
|
||||
): Promise<{ messageId: string }> => {
|
||||
const jid = toWhatsappJid(to);
|
||||
let payload: AnyMessageContent;
|
||||
if (mediaBuffer && (mediaType ??= "application/octet-stream")) {
|
||||
mediaType ??= "application/octet-stream";
|
||||
if (mediaBuffer && mediaType) {
|
||||
if (mediaType.startsWith("image/")) {
|
||||
payload = {
|
||||
image: mediaBuffer,
|
||||
|
||||
@@ -48,6 +48,7 @@ const MIME_BY_EXT: Record<string, string> = {
|
||||
".jpeg": "image/jpeg",
|
||||
".js": "text/javascript",
|
||||
".htm": "text/html",
|
||||
".xml": "text/xml", // pin text/xml as canonical (application/xml also maps to .xml in EXT_BY_MIME)
|
||||
};
|
||||
|
||||
const AUDIO_FILE_EXTENSIONS = new Set([
|
||||
|
||||
Reference in New Issue
Block a user