Private
Public Access
Add generic file attachments to chat messages
Messages can now carry an arbitrary file (MessageFile), parallel to the existing MessageImage feature rather than a refactor of it. Files serve with Content-Disposition: attachment to force a download and prevent an uploaded HTML/SVG from executing same-origin. No content-type allowlist, same 8MB cap as images for now (a separate size-limit redesign is tracked as its own issue). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -10,6 +10,15 @@ class ReactionSummary(BaseModel):
|
||||
user_ids: list[str]
|
||||
|
||||
|
||||
class MessageFileInfo(BaseModel):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: uuid.UUID
|
||||
filename: str
|
||||
size_bytes: int
|
||||
content_type: str
|
||||
|
||||
|
||||
class MessageRead(BaseModel):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
@@ -19,6 +28,7 @@ class MessageRead(BaseModel):
|
||||
username: str
|
||||
content: str | None
|
||||
image_id: uuid.UUID | None
|
||||
file: MessageFileInfo | None
|
||||
reactions: list[ReactionSummary]
|
||||
created_at: datetime
|
||||
edited_at: datetime | None
|
||||
|
||||
Reference in New Issue
Block a user