fix(api): support presigned webhook attachments (#2264)

This commit is contained in:
Hampus
2026-08-31 18:54:25 +02:00
committed by GitHub
parent 09cea4394f
commit a5395b0109
2 changed files with 47 additions and 23 deletions
@@ -7,6 +7,7 @@ import {
MessageFlagsDescriptions,
} from '@fluxer/constants/src/ChannelConstants';
import {AVATAR_MAX_SIZE, MAX_MESSAGE_LENGTH_PREMIUM} from '@fluxer/constants/src/LimitConstants';
import {ClientUploadedAttachmentRequest} from '@fluxer/schema/src/domains/message/AttachmentSchemas';
import {
MessageContentRequest,
MessageNonceRequest,
@@ -69,6 +70,8 @@ const WebhookAttachmentRequest = z.object({
filename: createStringType(1, 1024).optional().describe('Name of the file (1-1024 characters)'),
description: createStringType(1, 4096).optional().describe('Description for the attachment (max 4096 characters)'),
content_type: createStringType(1, 256).optional().describe('MIME type of the file'),
upload_filename: z.never().optional(),
file_size: z.never().optional(),
size: NonNegativeSafeIntegerType.optional().describe('Size of the file in bytes'),
url: URLType.optional().describe('URL of the attachment'),
proxy_url: URLType.optional().describe('Proxied URL of the attachment'),
@@ -89,7 +92,10 @@ export const WebhookMessageRequest = z
.object({
content: MessageContentRequest.nullish(),
embeds: z.array(RichEmbedRequest).optional().describe('Array of embed objects to include in the message'),
attachments: z.array(WebhookAttachmentRequest).optional().describe('Array of attachment objects'),
attachments: z
.array(z.union([ClientUploadedAttachmentRequest, WebhookAttachmentRequest]))
.optional()
.describe('Array of attachment objects'),
message_reference: MessageReferenceRequest.nullish().describe(
'Reference to another message (for replies or forwards)',
),