Files as attachments - #2179
Merged
Merged
Files as attachments#2179
Conversation
karlitschek
force-pushed
the
feat/file-attachments
branch
5 times, most recently
from
September 14, 2026 09:26
735a90f to
d1f6339
Compare
A post could carry pictures, video and audio and nothing else -- on a Nextcloud, where the file people want to share is the one thing that is already there. The allowlist gains the document kinds people actually share (PDF, plain text, Markdown, CSV, ZIP, EPUB, ODF and Office), and nothing a browser would run: no HTML, SVG or scripts. The picture ceiling (max_size) applies; a file is stored as it is, served as a download. On the client entity a file is Mastodon's `unknown` type with no preview of itself (the file used to be handed back as its own preview, which had a client try to draw a PDF), and when it was uploaded without a description it is named after itself -- the one field the entity has for saying what a file is. On the wire it is an ActivityPub Document with its mime, which Mastodon renders as a link and another Nextcloud as a file. The composer accepts, picks (the Files picker now offers them too) and takes dropped files of these kinds; a post shows a file as a named download card under its pictures, never in the mosaic or the viewer. Signed-off-by: Frank Karlitschek <frank@nextcloud.com> Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Frank Karlitschek <frank@nextcloud.com> Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
karlitschek
force-pushed
the
feat/file-attachments
branch
from
September 14, 2026 09:56
d1f6339 to
456fb82
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Item 12 of the fresh look: the "no document or file attachments" entry in the README — on a Nextcloud, of all places, where the file people want to share is the one thing already there.
What changes
CacheDocumentService::DOCUMENT_MIME_TYPES): PDF, plain text, Markdown, CSV, ZIP, EPUB, the ODF and Office document formats. Nothing a browser would run — HTML, SVG and scripts stay refused (tests pin.exe, JavaScript and a web page). The picture ceiling (max_size, 10 MB) applies; a file is stored as it is and served as a download.supported_mime_typeson/api/v1/instancelists them, since it is asked of the same allowlist.type: "unknown", with nopreview_url— the file used to be handed back as its own preview, which had a client try to draw a PDF. Uploaded without adescription, it is named after itself (bothPOST /mediaand the Files-picker route pass the name through); a picture with no alt text stays undescribed, which is a fact worth keeping.Documentwith its mime (that is Serve a stored post's attachments as Documents, with their mime #2172'smedia_typedoing its job); Mastodon shows it as a link, another Nextcloud as a file. Remote files of these kinds are now cached rather than dropped.MediaAttachmentshows a file as a named download card (icon, name, kind);PostAttachmentlists files under the pictures and keeps them out of the mosaic, the carousel and the viewer — a post that is only a file shows the file, not an empty gallery.Verification
isDocumentMime(), a PDF converts tounknownwithout a preview and keeps its name, the extension guess knows the new kinds, the Files-picker route names the file. Full suite green (4631), psalm no errors, php-cs-fixer clean.docs/API.mdupdated. Version 0.19.43.🤖 Generated with Claude Code